text:
Let's play Hangman?
According to this page, the best strategy to guess English hangman words is to calculate the odds of each letter in a word list that meet our conditions. But, as I'm really lazy, I don't really want to compute every word in the dictionary by myself. But, as I know that you are always here to help me, I'm sure you will be able to make me some king of a code that will do that for me. And, because my hard disk is nearly full, I'd like the smallest possible code. It means that this is code-golf, and the submission with the lowest amount of bytes will win, but also the most accurate one !.
Input/Output
A random word from this wordlist will be taken.
Your program should accept, in arguments, or by user input (popups, stdin, whatever),

Length of the word
Incorrect letter already found, or 0 if we just started the game, and you provided no incorrect letter.
Letters already found AND their position in the word

Example : ./hangsolver 6 XBZ 1P 4P 2E 6E Here, I picked the word "people". For clarity : P E _ P _ E (Wrong letters are X B and Z)
That means, in one game, I'll have to launch your script many times!
The output will be a single letter, your next try.
Rules

The one that will guess 10 words in less tries than the others will win.
In case of a tie, shortest code in bytes win.
If there is still a tie, the fastest program will win.
You may assume that there are only these words in the English language
I'll only try valid words from the wordlist.
I've got a good computer, CPU power won't be a problem ( but try to answer as fast as you can !)
You can't solve with an online solver, but you can download the wordlist, or have it passed as an argument. You can assume it will be named "wordlist.txt" and in the same directory as your script.
Your code must be able to run on a common OS. It could be windows, mac, or ubuntu/debian/CentOS or Redhat.
You can't use an external solver.
You can however shorten the URL to the wordlist.
This code-golf will end the first of September.
You MUST use the method described above.

Good luck !
Wordlist found here on SE.

Shortest code in bytes will win, with best guess being the tiebreak? That means that my program that simply guesses any random letter that hasn't been used before will beat someone elses that actually tries to work out a good guess. You may want to rethink your scoring, or you are going to get trivial answers.

"You MUST use the method described above.", I quote the rules. But I'll edit to make that the primary winning criteria

To be clear, "using the method described above" means guess the letter that appears in the largest number of the possible words that has not been guessed yet?

Yes, exactly. Thanks for the typo edit !

Shouldn't the input data in your example be "6 XBZ 1P 4P 2E 6E"?

Oh yeah, sorry. I'll edit.

You're right. Edited

PowerShell, 248 246 241 bytes
$a=$args;$c=$a[0];$b=$a[2..$c];((gc wordlist.txt)-match"^$((1..$c|%{$e=,"[^$($a[1])]"*$c}{$e[$_-1]=(((@($b)-match"^$_\D")[0]-split$_)[-1],$e[$_-1]-ne'')[0]}{$e-join''}))$"-join''-split'\B'|?{!(@($b)-match$_).Count}|group|sort count)[-1].Name

Ungolfed
Well, as much as I could without changing the way it works:
$a=$args
$c=$a[0]
$b=$a[2..$c]
(
    (gc wordlist.txt) -match "^$(
        (
            1..$c | ForEach-Object -Begin {
                $e = ,"[^$($a[1])]" * $c
            } -Process {
                $e[$_-1] = (
                    ( ( @($b) -match "^$_\D" )[0] -split $_ )[-1] , $e[$_-1] -ne ''
                )[0]
            } -End {
                $e-join''
            }
        )
    )$" -join '' -split'\B' |
    Where-Object {
        -not (@($b) -match $_).Count
    } |
    Group-Object |
    Sort-Object count
)[-1].Name

Breakdown
The approach I took here was to first generate a regular expression to get possible words out of the word list. Since I know the length of the word, and the letters that didn't work, I can make a regex out of that fairly easily.
So in the PEOPLE example, 6 letters with XBZ not being part of the word, I would look to generate ^PE[^XBZ]P[^XBZ]E$.
I'm exploiting the fact that Get-Content (gc) returns an array of lines, and the -match operator when used with an array on the left side, returns an array of matches instead of a bool, so I can quickly get a list of just words that are candidates, once I have the regex.
To generate the regex, I start with an array ($e) of the negative matching character class with $c elements ($c being the number of letters in the word). Iterating through the numbers 1 through $c, I check for a matched letter at that position, and if it exists, I replace the element in $e with that letter.
Once I've iterated through all of the positions, the final array is -joined (with empty string) and we have our regex.
So now I've got an array of all the possible words it could be. A quick -join with empty string on that, gives me one big concatenated string of all the words, the I split on \B (not a word boundary, if I split on empty string I will get 2 extra blank elements), so now I have an array of every letter in every possible word.
Piping that into Where-Object lets me filter out the letters that have already been matched. This part was a real pain. It had to deal with the list of matched letters (which include the position) being 1 element, more than 1 element, or 0 elements, hence forcing $b into an array first so that -match can operate on all them, but that (unfortunately in this case) returns an array, so we have to check .Count. Using !(thing).Count is a bit smaller than using (thing).Count-gt0.
Moving on, now we've got an array of all the single characters (as strings not as chars) from all of the words it could possibly be, minus the letters that were already guessed correctly.
Piping that into Group-Object gives me an object with the counts of each letter, so a quick pipe into Sort-Object count makes it easy to get the highest count. Rather than do (thing|sort count -des)[0] we can use (thing|sort count)[-1]. In PowerShell [-1] gets the last element. At this point we're still dealing with the objects that came from Group-Object so we get the .Name property which is the letter that appears the most.
Notes

Should work with PowerShell v3+; almost certainly will choke on 2.
Remember when you call a PowerShell script, pass arguments with spaces, not commas.
Although I didn't see it in the rules, it looks like everyone is using the filename wordlist.txt otherwise that could shave a few bytes off.
Speed shouldn't be a problem. This appears to run instantly for me. The slowest run I could get it to do (.\hangman.ps1 7 0) runs in about 350ms.

Welcome to Programming Puzzles & Code Golf Stack Exchange, great first answer! :)

Python3, 299 Bytes
import sys,collections as c;x,X,N,*Z=sys.argv;print([x for x in c.Counter(''.join([''.join(x)for x in map(set,filter(lambda l:len(l)==int(X)+1and all(x not in X.lower()for x in l)and all(l[int(x[0])-1]==x[1].lower()for x in Z),open('wordlist.txt')))]))if x not in ''.join(Z).lower()and x!='\n'][0])

pretty sure this can be golfed further.
Filters the wordlist for potential matches, builds a char frequency map, and selects the most often occuring character which is not yet picked.

You have a lot of ''.join(..)s. If all the elements inside are strings of length 1, you can change it to '..'[2::5], where the apostrophes are backticks.

Java, 646 640 631 607 606 (short) 790 789 779 (fast) bytes
SHORT
import java.util.*;class I{public static void main(String[]a)throws Exception{char[]w=a[1].toCharArray(),p,q;int l=Integer.parseInt(a[0]),i,z=w.length,j;q=new char[l];for(i=2;i<a.length;i++)q[Character.getNumericValue(a[i].charAt(0))-1]=(char)(a[i].charAt(1)+32);java.io.File u=new java.io.File("wordlist.txt");Scanner s=new Scanner(u);while(s.hasNextLine()){p=s.nextLine().toCharArray();if(p.length==l)for(i=0;i<l;i++)if(p[i]==q[i]||q[i]=='\0'){if(i==l-1)y:for(i=0;i<l;i++)for(j=0;j<z;j++)if(!(p[i]==w[j])){if(j==z-1){System.out.print(p[new String(q).indexOf('\0')]);return;}}else break y;}else{break;}}}}

FAST
import java.util.*;class I{public static void main(String[]a)throws Exception{char[]w=a[1].toCharArray(),p,q;int l=Integer.parseInt(a[0]),i,z=w.length,j,k,o,n[]=new int[255],r[];q=new char[l];for(i=2;i<a.length;i++)q[Character.getNumericValue(a[i].charAt(0))-1]=(char)(a[i].charAt(1)+32);String m=new String(q);java.io.File u=new java.io.File("wordlist.txt");Scanner s=new Scanner(u);while(s.hasNextLine()){p=s.nextLine().toCharArray();h:if(p.length==l)for(i=0;i<l;i++)if(p[i]==q[i]||q[i]=='\0'){if(i==l-1)y:for(i=0;i<l;i++)for(j=0;j<z;j++)if(p[i]!=w[j]){if(j==z-1){for(k=0;k<l-m.replace("\0","").length();k++)n[(int)p[new String(q).indexOf('\0',k)]]++;break h;}}else break y;}else{break;}}r=n.clone();Arrays.sort(n);for(o=0;o<255;o++)System.out.print(r[o]==n[254]?(char)o:"");}}

Put the wordlist file in the folder.
Short version algorithm

Load Args
Construct the word we are trying to guess {'p','e','\0','p','\0','e'}
Load WordList
Go through each line of WordList
Stop when you find that the whole word matches this condition p[i] == q[i] || q[i] == '\0' where p is a word from the wordlist (char array), and q is the word we are trying to guess
Loop through wrong chars and compare to the word
Print the first missing character

Long version algorithm

Short steps 1-7
Increment the character count in the n array for the missing chars
Loop until all the words come through
Print the character that had the highest count

can I remove the imports?

Is it ok to remove java imports in code golf?

it's ok, as long as you specify I Should import them (if not obvious) ;)

Kk. I will update it when i come back home. Gonna go buy a new router :) and 90 feet of Cat5e

I don't think it works for words longer than 9 letters. Try using "prospective" from the wordlist with input "6 XBZ 1P 5P 6E 11E"
Perhaps changing the first loop to q[Integer.parseInt(a[i].substring(0,a[i].length()-1))-1]=(char)(a[i].charAt(a[i].length()-1)+32);
Also, a golfing tip: Try using Scanner s=new Scanner(new java.io.File("wordlist.txt"));

PHP, 346 bytes
<?php $a='array_shift';$p='preg_match';$a($v=&$argv);$w=array_fill(1,$a($v),'(.)');$c=$a($v);foreach($v as$q)$p('/(\d+)(\w)/',$q,$m)&&$w[$m[1]]=$m[2];foreach(file('wordlist.txt')as$y)if($p("/^".implode($w)."$/",$y=strtoupper(trim($y)),$m)&&(!$c||!$p("/[$c]/",$y)))for($i=0;$i++<count($m);)($v=@++$g[$m[$i].$i])&&$v>@$t&&$t=$v&&$l=$m[$i];echo @$l;

It works as follows:

Creates a regex pattern for matching the letters guessed so far
Iterates over each word from the file
If the word matches the regex, it makes sure that it doesn't contain one of the wrong letters
Increments a counter for each of the possible letters of that word (based on their position)
Outputs the letter with the highest counter

Assumptions:

PHP >=5.4
There is a wordlist.txt file in the current folder

`php hangman.php 6 YH 2E 6E 3O 1P 4P
PHP Notice:  Undefined offset: 2 in ./Desktop/hangman.php on line 1
Notice: Undefined offset: 2 in ./Desktop/hangman.php on line 1` Tried to make him guess people

Thanks for pointing it out. There was an small bug in the code. I updated it (still 346 bytes).

Powershell, 153 bytes
Inspired by briantist's answer.
As other writers I used the filename wordlist.txt. Although it was possible to choose a shorter name.
param($l,$b,$c)((sls "^$(-join(1..$l|%{$p=$c|sls "$_."|% m*
("$p"[1],"[^$b$c]")[!$p]}))$" wordlist.txt|% l*e|% t*y|group|sort c*).Name-match"[^ $c]")[-1]

Less golfed test script:
$f = {

param($length,$bad,$chars)

$wordPattern=-join(1..$length|%{                  # join all subpatterns for $_ from 1 to $length
    $c=$chars|sls "$_."|% Matches                 # find subpattern in char array
    ("$c"[1],"[^$bad$chars]")[!$c]                # return a first char of subpattern if subpattern found, or bad characters
})

# Note 1: The word subpattern is similar to 'PE[^XBZ1P 4P 2E 6E]P[^XBZ1P 4P 2E 6E]E'
#         Spaces and digits does not affect the search for letters, only letters are important.
#
# Note 2: The same applies to 0. [^0] matches any letter.
#

$matches=sls "^$wordPattern$" wordlist.txt|% Line # find matched words in file wordlist.txt and return matched string only
$groups=$matches|% toCharArray|group|sort Count   # group all chars in matched words by count
$name=$groups.Name-match"[^ $chars]"              # select property Name from all grouped elements (chars itself) and return not matched to $chars only
$name[-1]                                         # return last element in the sorted array (most frequently found char)

# Note 3: The space is important in the regexp "[^ $chars]"
#         The space makes the regexp valid if the $chars array is empty

}

&$f 7 0 2o,5e,7t
&$f 7 nl 2o,5e,7t
&$f 6 XBZ 1P,4P,2E,6E

Output:
c
r
l

Variable values for &$f 7 0 2o,5e,7t:
$WordPattern: "[^02o 5e 7t]o[^02o 5e 7t][^02o 5e 7t]e[^02o 5e 7t]t"
$Matches: concept collect comment correct connect convert consent concert
$Groups:
    Count Name                      Group
    ----- ----                      -----
        1 p                         {p}
        1 v                         {v}
        1 s                         {s}
        2 m                         {m, m}
        2 l                         {l, l}
        4 r                         {r, r, r, r}
        8 n                         {n, n, n, n...}
        8 o                         {o, o, o, o...}
        8 t                         {t, t, t, t...}
        8 e                         {e, e, e, e...}
       13 c                         {c, c, c, c...}
$name: p v s m l r n c
$name[-1]: c
return: c

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Can you reach this number by doubling and rearranging?
Inspired by this question on Math.SE.
Starting with 1 you can repeatedly perform one of the following two operations:

Double the number.
or
Rearrange its digits in any way you want, except that there must not be any leading zeroes.

Taking an example from the linked Math.SE post, we can reach 1000 via the following steps:
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 125, 250, 500, 1000

Which numbers can you reach with this process and what is the shortest solution?
The Challenge
Given a positive integer N, determine the shortest possible sequence of integers to reach N with the above process, if possible. If there are several optimal solutions, output any one of them. If no such sequence exists, you should output an empty list.
The sequence may be in any convenient, unambiguous string or list format.
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter.
This is code golf, so the shortest answer (in bytes) wins.
Test Cases
Here is a list of all reachable numbers up to and including 256. The first column is the number (your input), the second column is the optimal number of steps (which you can use to check the validity of your solution) and the third column is one optimal sequence to get there:
1       1       {1}
2       2       {1,2}
4       3       {1,2,4}
8       4       {1,2,4,8}
16      5       {1,2,4,8,16}
23      7       {1,2,4,8,16,32,23}
29      10      {1,2,4,8,16,32,23,46,92,29}
32      6       {1,2,4,8,16,32}
46      8       {1,2,4,8,16,32,23,46}
58      11      {1,2,4,8,16,32,23,46,92,29,58}
61      6       {1,2,4,8,16,61}
64      7       {1,2,4,8,16,32,64}
85      12      {1,2,4,8,16,32,23,46,92,29,58,85}
92      9       {1,2,4,8,16,32,23,46,92}
104     15      {1,2,4,8,16,32,64,128,256,512,125,250,205,410,104}
106     14      {1,2,4,8,16,32,64,128,256,265,530,305,610,106}
107     14      {1,2,4,8,16,32,23,46,92,29,58,85,170,107}
109     18      {1,2,4,8,16,32,23,46,92,184,368,386,772,277,554,455,910,109}
116     12      {1,2,4,8,16,32,23,46,92,29,58,116}
122     7       {1,2,4,8,16,61,122}
124     16      {1,2,4,8,16,32,23,46,92,29,58,85,170,107,214,124}
125     11      {1,2,4,8,16,32,64,128,256,512,125}
128     8       {1,2,4,8,16,32,64,128}
136     18      {1,2,4,8,16,32,23,46,92,184,148,296,592,259,518,158,316,136}
140     15      {1,2,4,8,16,32,64,128,256,512,125,250,205,410,140}
142     16      {1,2,4,8,16,32,23,46,92,29,58,85,170,107,214,142}
145     17      {1,2,4,8,16,32,23,46,92,184,368,736,376,752,257,514,145}
146     18      {1,2,4,8,16,32,64,128,256,512,125,250,205,410,104,208,416,146}
148     11      {1,2,4,8,16,32,23,46,92,184,148}
149     16      {1,2,4,8,16,32,64,128,182,364,728,287,574,457,914,149}
152     11      {1,2,4,8,16,32,64,128,256,512,152}
154     17      {1,2,4,8,16,32,23,46,92,184,368,736,376,752,257,514,154}
158     16      {1,2,4,8,16,32,23,46,92,184,148,296,592,259,518,158}
160     14      {1,2,4,8,16,32,64,128,256,265,530,305,610,160}
161     13      {1,2,4,8,16,32,23,46,92,29,58,116,161}
163     18      {1,2,4,8,16,32,23,46,92,184,148,296,592,259,518,158,316,163}
164     18      {1,2,4,8,16,32,64,128,256,512,125,250,205,410,104,208,416,164}
166     20      {1,2,4,8,16,32,23,46,92,184,368,736,376,752,257,514,154,308,616,166}
167     17      {1,2,4,8,16,32,23,46,92,184,148,296,269,538,358,716,167}
169     23      {1,2,4,8,16,32,64,128,256,512,125,250,205,410,104,208,416,461,922,229,458,916,169}
170     13      {1,2,4,8,16,32,23,46,92,29,58,85,170}
176     17      {1,2,4,8,16,32,23,46,92,184,148,296,269,538,358,716,176}
182     9       {1,2,4,8,16,32,64,128,182}
184     10      {1,2,4,8,16,32,23,46,92,184}
185     16      {1,2,4,8,16,32,23,46,92,184,148,296,592,259,518,185}
188     23      {1,2,4,8,16,32,23,46,92,184,148,296,592,259,518,185,370,740,470,940,409,818,188}
190     18      {1,2,4,8,16,32,23,46,92,184,368,386,772,277,554,455,910,190}
194     16      {1,2,4,8,16,32,64,128,182,364,728,287,574,457,914,194}
196     23      {1,2,4,8,16,32,64,128,256,512,125,250,205,410,104,208,416,461,922,229,458,916,196}
203     16      {1,2,4,8,16,32,64,128,256,265,530,305,610,160,320,203}
205     13      {1,2,4,8,16,32,64,128,256,512,125,250,205}
208     16      {1,2,4,8,16,32,64,128,256,512,125,250,205,410,104,208}
209     19      {1,2,4,8,16,32,23,46,92,184,368,736,376,752,257,514,145,290,209}
212     8       {1,2,4,8,16,61,122,212}
214     15      {1,2,4,8,16,32,23,46,92,29,58,85,170,107,214}
215     11      {1,2,4,8,16,32,64,128,256,512,215}
218     9       {1,2,4,8,16,32,64,128,218}
221     8       {1,2,4,8,16,61,122,221}
223     14      {1,2,4,8,16,32,23,46,92,29,58,116,232,223}
227     20      {1,2,4,8,16,32,23,46,92,184,148,296,592,259,518,158,316,361,722,227}
229     20      {1,2,4,8,16,32,64,128,256,512,125,250,205,410,104,208,416,461,922,229}
230     16      {1,2,4,8,16,32,64,128,256,265,530,305,610,160,320,230}
232     13      {1,2,4,8,16,32,23,46,92,29,58,116,232}
233     22      {1,2,4,8,16,32,23,46,92,184,368,736,376,752,257,514,154,308,616,166,332,233}
235     19      {1,2,4,8,16,32,23,46,92,184,148,296,269,538,358,716,176,352,235}
236     19      {1,2,4,8,16,32,23,46,92,184,148,296,592,259,518,158,316,632,236}
238     19      {1,2,4,8,16,32,64,128,256,512,125,250,205,410,104,208,416,832,238}
239     25      {1,2,4,8,16,32,23,46,92,184,368,736,376,752,257,514,154,308,616,166,332,233,466,932,239}
241     16      {1,2,4,8,16,32,23,46,92,29,58,85,170,107,214,241}
244     8       {1,2,4,8,16,61,122,244}
247     21      {1,2,4,8,16,32,23,46,92,184,148,296,592,259,518,158,316,632,362,724,247}
248     17      {1,2,4,8,16,32,23,46,92,29,58,85,170,107,214,124,248}
250     12      {1,2,4,8,16,32,64,128,256,512,125,250}
251     11      {1,2,4,8,16,32,64,128,256,512,251}
253     19      {1,2,4,8,16,32,23,46,92,184,148,296,269,538,358,716,176,352,253}
256     9       {1,2,4,8,16,32,64,128,256}

If you want even more test data, here is the same table up to and including 1,000.
Any number not appearing on these tables should yield an empty list (provided the number is in the range of the table).

Are there any bounds on the execution time?

@Fatalize no, go crazy.

I suppose potentially infinite execution time is not acceptable though? It has to theoretically terminate?

@Fatalize Ah yes, as usual.

What about when there is more than one result:
[1, 2, 4, 8, 16, 32, 64, 46, 92, 29]
[1, 2, 4, 8, 16, 32, 23, 46, 92, 29]

Unfortnately i have no access to a pc right now, so I probably won't add any submission  before tomorrow. But would it be legit to reverse the process by starting at N, either multiplying by .5 or reordering the digits? I would think this might open some benefits like a natural boundary as, as soon in a path were N equals 3 it's invalid and you can stop. Or am I missing something crucial there? Also - I assume reordering has to happen in base 10, like, can I cycle  the bits of a base 2 representation of same N to perform a reordering? - of course without leading zeroes

@user1147618 "If there are several optimal solutions, output any one of them."

@C5H8NNaO4 the permutation has to be done in base 10. It doesn't matter if you search forwards or backwards as long as you output the result forwards.

Pyth, 43 bytes
?}QKhu?Jf}QTGJsm+Ld+yedsMfnhT\0.p`edGQ]]1KY

Demonstration.
This is starts by generating all possible double or rearrange sequences. However, since I actually wanted to see it finish, I added a short circuit.
It either runs until it finds a solution, or for a number of iterations equal to the input, at which point it gives up and returns [].

This is guaranteed to be enough iterations. First, we know that this many iterations is enough for all n <= 1000, thanks to the example results. For larger numbers, the following argument holds:
First, each step of the process must either maintain or increase the number of digits.
Second, three numbers that are all rearrangements of one another can never all appear in a shortest sequence, because it would have been quicker to just do a single rearrangement from the first to the last.
Third, all multiples of 3 are unreachable, because neither doubling nor rearrangement can produce a multiple of 3 from a non-multiple of 3.
Thus, the longest possible sequence ending at a given number is equal to the sum of twice the number of sets of digits with less than or equal to as many digits as the input, and where the digits do not sum to a multiple of 3.
The number of such digit sets for each number of digits:
4 - 474
5 - 1332
6 - 3330

In addition, we know from the examples that no shortest sequence ending with a 3 digit number is of length greater than 26. Thus, an upper bound of the sequence lengths is:
4: 474 * 2 + 26 = 974
5: 974 * 2 + 1332 = 3638
6: 3330 * 2 + 3638 = 10298

In each case, the upper bound is lower than any number with the number of digits
The number of digit sets cannot grow by more than a factor of 10 when the number of digits is increased by one, because the new numbers can be separated into groups by last digit, each of which cannot have more sets than there were with one fewer digit.
Thus, the upper bound will be lower than any number with that many digits for all possible numbers of digits greater than or equal to 4, which completes the proof that a number of iterations equal to the input is always enough.

Are you sure a number of iterations equal to the input is enough? In theory wouldn't the upper bound be around the next greater power of 10 (since the sequence can decrease arbitrarily often).

@MartinBüttner Good point. I think there should be a proof that the input is always enough, but I'll edit it for now.

@MartinBüttner Proof that iterations equal to input is always enough added.

Ah, very nice. :) (Interestingly, even up to 100,000 you don't need more than 26 steps.)

I believe it would be faster to enumerate all steps not longer than the input?

I can't get 136 to work online. Well, 3 doesn't work either.

@aditsu 136 would be over the timeout. 3 should work now - fixed the link.

SWI-Prolog, 252 bytes
a(N,Z):-findall(X,b(N,[1],X),R),sort(R,[Z|_]);Z=[].
b(N,[A|T],Z):-n(A,C),n(N,M),length(C,L),length(M,O),L=<O,((A=N,reverse([A|T],Z));(A\=N,(B is A*2;permutation(C,D),\+ nth0(0,D,48),n(B,D),\+member(B,[A|T])),b(N,[B,A|T],Z))).
n(A,B):-number_codes(A,B).

Example: a(92,Z). outputs Z = [1, 2, 4, 8, 16, 32, 64, 46, 92]
I haven't checked yet that this works for N > 99 because of the time it takes, but I see no reason why it wouldn't work.

Julia, 306 245 218 bytes
Still working on golfing this. Will provide an ungolfed version once I'm done.
s->(M=s=[s];while 1∉s C=0;for i=1:size(s,1) p=2;for j=permutations(dec(s[i])) j[1]>48&&j[end]%2<1&&(l=int(j);l=l÷p;l∉M&&(M=[M,l];S=[l s[i,:]];C==0?C=S:C=[C;S]));p=1end;end;C==0&&return [];s=C;end;sortrows(s)[1,:])

Haskell, 246 bytes
I am not entirely sure if this works, it does iff the sequence that first diverges lower (as to be sorted lower) is always shorter, as for example
[1,2,4,8,16,32,64,128,256,512,125,250,500,1000]
is shorter than
[1,2,4,8,16,32,64,128,256,512,251,502,250,500,1000]
which i tested to be true up to 1000.
import Data.List
h l|mod(e l)2==0=l:h(div(e l)2:l)|0<1=[l]
s l=map((:l).read)(filter((/='0').e)(permutations$show$e l))
e=head
m=map e
n f=m.groupBy(\a b->e a==e b).sort.concatMap f
w l|e(e l)==1=[nub$e l]|m x/=m l=w x|0<1=[[]] where x=n h(n s l)

C# 655 bytes
List<int> C(int i,List<int> x,int a){x.Add(a);if(a==i)return x;List<int> o=null;string s=a.ToString(),m=i.ToString();var res=G(s,s.Length);foreach (var r in res)if (r.First()!='0'){var l=int.Parse(new String(r.ToArray()));if(!x.Contains(l)&&l.ToString().Length<=m.Length){var n=C(i,x.ToList(),l);if(n!=null&&(o==null||o.Count()>n.Count()))o=n;}}if ((a*2).ToString().Length>m.Length)return o;var p = C(i, x.ToList(), a * 2);if (p!=null&&(o==null||o.Count()>p.Count()))o=p;return o;}IEnumerable<IEnumerable<T>> G<T>(IEnumerable<T> l,int i){return i==1?l.Select(t =>new T[]{t}):G(l,i-1).SelectMany(t=>l.Where(e=>!t.Contains(e)),(a,b)=>a.Concat(new T[]{b}));}

Call with (LinqPad):
var i = 64;
C(i,new List<int>(),1).Dump();

Haven't tested numbers above 99. If you have time -> good luck ;-)
edit: ungolfed version:
List<int> C(int i, List<int> x, int toAdd, bool removeLast)
{
    x.Add(toAdd);

    if ( toAdd == i )
    {
        return x;
    }
    else
    {
        List<int> shortest = null;
        if ( toAdd > 9 )
        {
            var res = G(toAdd.ToString(), toAdd.ToString().Length);

            foreach ( var r in res )
            {
                if ( r.First () != '0' )
                {
                    var resi = int.Parse(new String(r.ToArray()));

                    if ( !x.Contains(resi) && resi.ToString().Length <= i.ToString().Length )
                    {
                        var resPerm = C(i, x.ToList(), resi, false);
                        if ( resPerm != null )
                        {
                            if ( shortest == null || shortest.Count() > resPerm.Count() )
                            {
                                shortest = resPerm;
                            }
                        }
                    }
                }
            }
        }
        if ( (toAdd * 2).ToString().Length > i.ToString().Length )
        {
            return shortest;
        }
        var resDouble = C(i, x.ToList(), toAdd * 2, false);
        if ( resDouble != null )
        {
            if ( shortest == null || shortest.Count() > resDouble.Count() )
            {
                shortest = resDouble;
            }
            return shortest;
        }

        return shortest;
    }
}
IEnumerable<IEnumerable<T>> G<T>(IEnumerable<T> l,int i)
{
    return i==1?l.Select(t => new T[]{t}):G(l,i-1).SelectMany(t=>l.Where(e=>!t.Contains(e)),(a,b)=>a.Concat(new T[]{b}));
}

CJam, 83
ri:N_1a:Xa:Y;{X,{XI=__se!{c~},:i^\2*|NA*,&X-_YI=f+Y\+:Y;X\+:X;}fI}*X#_){Y=W%}{;L}?p

Try it online
I've been sitting on this for a long time, it's not very short nor fast, and I'm not sure I have the energy/motivation to improve it, so I'm just posting it.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
The hue of a color
You are given the RGB values of a color. Your task is simple: to calculate the hue, in the simplest definition.
Say the channels with highest, middle and lowest value are X, Y, Z (which are either red, green or blue) and their values are x, y, z. The hue of this color is (h(X)-h(Y))*(1 + (x-y)/(x-z))/2 + h(Y), where:
h(red) = 0 (or 360 if one of X or Y is blue)
h(green) = 120
h(blue) = 240

The input consists of 3 integers from 0 to 255 which are not all equal, in any consistent order. The output can be floats, or integers rounded either up or down, which doesn't have to be consistent. If the integer part of the output is 0 or 360, you can print either of them.
You cannot call builtins for color space conversions, including implicit conversions such as while manipulating an image.
This is code-golf. Shortest code wins.
Examples
Input:  0 182 255
Output: 197 (or 198)

Input:  127 247 103
Output: 110

Input:  0 0 1
Output: 240

Input:  255 165 245
Output: 307 (or 306)

Edit
You don't have to follow the exact formula, but only have to give the same result as the above formula. I'd like to also see some answers golfing the formula itself.

Should we convert from sRGB to a linear scale first? I think we should, but nobody seems to have so far.

@JanDvorak The task is to calculate the hue, in the simplest definition. In this case, "simplest" means you should assume the input is already in the right scale, and use the exact formula given in the question or anything that gives the same result.

But... 24 bpp usually means sRGB. If not, the format specification (you) should specify otherwise.

@JanDvorak You should use this definition for RGB and the hue.

It has to be said: huehuehue.

@TheDoctor "No, I'm the clever one. You're the potato."

Pyth, 27 bytes
*60%+c-Ft.<QJxQKeSQ-KhSQyJ6

Demonstration.
Test harness.
Fomula taken from Wikipedia.
Essentially, the steps are:

.<QJxQKeSQ: Roate the largest value to the front of the list.
-Ft: Take the difference of the other two values.
-KhSQ: Subtract the minimum value from the maximum value.
c: Divide 2 by 3.
+ ... yJ Add twice the index of the maximum value in the list (0 if R, 2 if G, 4 if B).
% ... 6: Mod 6, to fix issues with negatives.
*60: Multiply by 60 to convert to degrees, and print.

C#, 188 210 206 197 191 bytes
int H(int r,int g,int b){int[]a={r,g,b};System.Array.Sort(a);int x=a[2],y=a[1],c=x==g?1:(x==b?2:(y==b?3:0)),d=y==g?1:(y==b?2:(x==b?3:0));return(int)((c-d)*120*(1+(x-y)*1D/(x-a[0]))/2+d*120);}

Thanks to Sok for saving 4 bytes and to SLuck49 for saving 15!

As you only use z once in the output calculation, and you don't use it in the preceding calculations, you do away with the variable and change the output to return(int)((c-d)*(1+(x-y)/(double)(x-a[0]))/2+d);, saving you 4 bytes.

You can factor 120 out of the c and d assignments and into the return like this c=x==g?1:(x==b?2:(y==b?3:0)),d=y==g?1:(y==b?2:(x==b?3:0)) and then return(int)((c-d)*120*(1+(x-y)/(double)(x-a[0]))/2+d*120); to save 4 bytes.

Also do you really need the cast to double? If you do you can use this instead (x-a[0])*1D to save another 5 bytes.

@SLuck49 Thanks! Yes, I actually need the cast, it gives inaccurate results otherwise, but that *1D multiplication is a nice trick!

Also also (just noticed) you can drop the using all together by fully qualifying System.Array for another 6 bytes.

@SLuck49 Well spotted, thanks! :)

Pyth, 41 55 53 51 bytes
A.)JohN,VQ*L120?qeQhSQ3j312T+/*-HKeeJhc-GheJ-GhhJ2K

Input is expected in the form r,g,b. Here's an explanation:
                                                        Implicit: Q=eval(input()), evaluates to (r,g,b)
               ?qeQhSQ                                  Is b the smallest?
                      3j312T                            Choose [0,1,2] or [3,1,2] based on above
          *L120                                         Convert to [0,120,240] or [360,120,240]
       ,VQ                                              Pair -> [[r,0/360],[g,120],[b,240]]
   JohN                                                 Order by 1st element in each pair, store in J
A.)J                                                    Pop biggest from J, set G = x, H = h(X)
                                                        Output calculation:
                                       -GheJ                x - y
                                            -GhhJ           x - z
                                     hc                     Divide and increment
                                 KeeJ                       Set K = h(Y)
                              *-HK                          Multiply by (h(X) - h(Y))
                             /                   2          Integer division by 2
                            +                     K         Add h(Y)

Saved 4 bytes, thanks to @Jakube and @isaacg

@jimmy23013 Fixed, thanks for the extra test case

A couple of golfs: m*120d -> *L120, save eeJ to K inline to save another byte.

@isaacg I didn't know the L operator generated a range on an int automatically, every day is a shcool day it seems :o) Thanks!

Javascript (ES6), 145 115 108 100 97 90 bytes
Returns floats. Assign to a function to use.
(r,g,b)=>([x,y,z]=[r,g,b].sort((a,b)=>b-a),m=x-z,(x-r?x-g?r-g+4*m:b-r+2*m:g-b+6*m)/m%6*60)

Saved 30 bytes by inlining everything into a single ternary operator sequence and waiting until the end to normalize to 0-360.
Thanks to edc65, Vasu Adari, and ETHproductions for saving even more bytes.
JSFiddle with tests. Try in Firefox.
If removing the function declaration h= is not legal, add 2 bytes.

You can remove 'var' and some bytes.

ES6Fiddle needs the var declaration for some reason and I didn't realize it wasn't necessary until I tried ES6 in firefox

You can save 6 bytes by replacing the curly braces with parentheses, the semicolon with a comma, and removing the return. I believe removing the function declaration (h=) is also legal, bringing the total down to 100.

This may be obsessive (then again, aren't all good golfers? ;) ), but you could save two more bytes by getting rid of the parenthesis in %6)*60 and its partner on the other side. Also, using brute force on the addition (instead of adding 6 at the end) would actually save one byte over your current setup. (((x==r?(g-b)/m:x==g?2+(b-r)/m:4+(r-g)/m)+6)%6)*60 would become (x==r?6+(g-b)/m:x==g?8+(b-r)/m:10+(r-g)/m)%6*60.

Instead of doing [x,y,z]=[r,g,b].sort((a,b)=>b-a). You could just do [z,y,x]=[r,g,b].sort() and save 10 bytes.

@Vasu Adari unfortunately for some strange reason the default implementation of sort casts everything to a string and sorts lexically, ie (10, 15, 7, 1, 8) will become (1, 10, 15, 7, 8) which isn't what we want.

@DankMemes Aah i didn't know that. Got it.

+1 for the sort, very clever, This is 90 (or 92) (r,g,b)=>([m,_,M]=[r,g,b].sort((a,b)=>a-b),C=M-m,(M-r?M-g?r-g+4*C:b-r+2*C:g-b+6*C)/C%6*60)

@edc65 very clever removal of parenthesis. In my changes, I kept my variable names and sort order. Also, the code now fits in a single line of the stackexchange code box :)

Awarded the bounty to you because you seemed to be the first to use this formula, and nobody came up with a more different one.

@jimmy23013 thanks!

Octave, 65 60 50 bytes
Edit: Saved 10 bytes thanks to pawel.boczarski
An approximate solution...
@(c)mod(atan2d(.866*c*[0;1;-1],c*[2;-1;-1]/2),360)

Test run
@(c)mod(atan2d(.866*c*[0;1;-1],c*[2;-1;-1]/2),360)
ans([0   182   255])
ans =  196.14

@(c)mod(atan2d(.866*c*[0;1;-1],c*[2;-1;-1]/2),360)
ans([127   247   103])
ans =  111.05

@(c)mod(atan2d(.866*c*[0;1;-1],c*[2;-1;-1]/2),360)
ans([0   0   1])
ans =  240.00

@(c)mod(atan2d(.866*c*[0;1;-1],c*[2;-1;-1]/2),360)
ans([255   165   245])
ans =  305.82

Octave, 107 bytes
My original (exact-ish) solution...
Code:
function H=r(c) [b,i]=sort(c);h=60*[6*(i(1)~=3),2,4](i);H=(h(3)-h(2))*(1+(b(3)-b(2))/(b(3)-b(1)))/2+h(2);

Explained:
function H=r(c)
   [b,i]=sort(c);
   h=60*[6*(i(1)~=3),2,4](i);
   H=(h(3)-h(2))*(1+(b(3)-b(2))/(b(3)-b(1)))/2+h(2);

This function takes a vector containing the R,G,B values as input c and sorts the input in ascending order

b contains the sorted values [z, y, x]
i contains the RGB plane associated with each value in b

The vector h is populated with the values

60*[6, 2, 4] = [360, 120, 240] (but 3 bytes shorter)
unless the lowest value is in Blue (i(1) == 3), in which case the first hue value becomes zero
then use (i) to rearrange h into [h(Z), h(Y), h(X)] order

From there it's just a straight transcription of the formula.
You can try it here.

Hint: use anonymous function notation to squeeze more bytes: @(c)mod(atan2d(.866*c*[0;1;-1],c*[2;-1;-1]/2),360) is ten bytes shorter than definition with function keyword.

@pawel.boczarski I was wondering if I could do away with the function header altogether, but I don't know if that's legit. But thanks for the tip! :D

@pawel.boczarski Looking back at this, I still need a r= before the anonymous function in order to call it, right?

There are many solutions where anonymous functions are posted. Moreover, you could call the so-defined function even like this: (@(c)mod(atan2d(.866*c*[0;1;-1],c*[2;-1;-1]/2),360))([127 247 103]) , or argue that you can use ans variable right after the anonymous function was defined, so that assignment is not necessary for the function definition to be complete. In one challenge (http://codegolf.stackexchange.com/questions/54945/) a handle of existing Matlab library function was posted as full solution.

@pawel.boczarski Wow, that's... just... evil :D I should have known Luis would be involved. I'll revert to the original code and use ans in the sample. Thanks again!

Pyth, 55
I know @Sok's answer beats mine, but since I finished mine just after he/she posted, I thought I would still post. This was my first time using Pyth so I'm sure I made some obvious mistakes.
DlZK*120ZRKJSQFNJ=Y+YxQN)=kl@Y1+k/*-leYk+1c-eJ@J1-eJhJ2

Input is expected to be r, g, b. You can try it here.

Doesn't work for 255,165,245.

PowerShell, 232 226 222 161 Bytes
See revision history for previous versions
$z,$y,$x=($r,$g,$b=$args)|sort
$c=((2,(0,3)[$y-eq$b])[$x-ne$b],1)[$x-eq$g]
$d=((2,(0,3)[$x-eq$b])[$y-ne$b],1)[$y-eq$g]
(($c-$d)*120*(1+($x-$y)/($x-$z))/2+$d*120)

Hoo boy, let's see if I can walk through this. Since \n counts the same as ; I left the line breaks in for clarity.
The first line takes input as three $args and stores them into $r, $g, $b. We're really only going to be using $b later, but we need all three so the |sort works appropriately. This makes $z, $y, $x the smallest-to-largest of the input arguments.
The next two lines setup $c and $d by using multiple index-into-an-array calls to set the numbers appropriately. Working from outside in, if $x is -equal to $g (i.e., green was the largest), we set $c=1 ... else, if $x is -notequal to $b (i.e., blue wasn't the largest) $c is either 0 or 3 depending if blue was the second largest ... else, $c=2. Similar logic sets $d.
We then calculate and print the output with the following, which is just the algorithm from the challenge golfed a little bit.
(($c-$d)*120*(1+($x-$y)/($x-$z))/2+$d*120)

I don't know PowerShell, so correct me if I'm wrong... You don't use $z when calculating $c or $d, and you only use it once in the output calculation, so can you get rid of $z entirely and replace it with $a[0]?

Ruby, 117 96 94 bytes
Code:
h=->r,g,b{z,y,x=[r,g,b].sort;v=x-z.to_f;({r=>(g-b)/v,g=>2+(b-r)/v,b=>4+(r-g)/v}[x]%6*60).to_i}

Saved 21 bytes by removing () and using r,g,b variables.
Taking modulus of 6 to convert negative value and multiplying it
by 60 to convert to degrees that saved 2 bytes.

Examples:
irb(main):274:0> h.call 0,182,255
=> 197
irb(main):275:0> h.call 127,247,103
=> 110
irb(main):276:0> h.call 0,0,1
=> 240
irb(main):277:0> h.call 255,165,245
=> 306

SWI-Prolog, 133 bytes
a(L,H):-L=[R,G,B],max_list(L,X),min_list(L,Y),member(X:I:J:U,[R:G:B:0,G:B:R:2,B:R:G:4]),Z is 60*(U+(I-J)/(X-Y)),(Z<0,H is Z+360;H=Z).

Example: a([255,165,245],Hue). outputs Hue = 306.666666666666 .
This uses the following formula:

Max = max(R,G,B), Min = min(R,G,B).
If Max = R, U = 0. Else if Max = G, U = 2. Else U = 4.
If Max = R, I = G and J = B. Else if Max = G, I = B and J = R. Else I = R and J = G.
Z = U + (I - J)/(Max - Min)
Hue is either Z or Z + 360 if Z < 0.

Rounding is optional.

Perl 5, 138 132 119 bytes
Code:
($m,$c,$M)=sort@A=($R,$G,$B)=@ARGV;print 60*(6+$M>$m?($G>$c?$B-$R:$B>$c?$R-$G:$G-$B)/($M-$m)+($G>$c?2:$B>$c?4:0):0)%360

Remarks:
Surely Perl can't win such challenge with all the Pyth'oresque golfing.
But I wondered if this was possible to do with only 1 calculation step.
Thanks to the modulus that worked out nicely. :)
Test:
$ perl hue.pl 0 182 255
197
$ perl hue.pl 127 247 103
110
$ perl hue.pl 0 0 1
240
$ perl hue.pl 255 165 245
307

comparing to the middle value instead of the maximum shaved some bytes. (== versus >)

R, 125 bytes
Very similar to beaker's Octave solution. Floating point output.
Code:
h=function(x){
  o=seq(3)[order(-x)];
  y=c(60*c(6*(o[3]!=3),2,4)[o],x[o]);
  return((y[1]-y[2])*(1+(y[4]-y[5])/(y[4]-y[6]))/2+y[2]);
}

Examples:
> h(c(0,182,255))
[1] 197.1765
> h(c(127,247,103))
[1] 110
> h(c(0,0,1))
[1] 240
> h(c(255,165,245))
[1] 306.6667

Python, 154 bytes
def h(c):r=c[:];c.sort();c=c[::-1];x,y,z=c;i,j=[120if n==r[1]else 240if n==r[2]else 0if z==r[2]else 360for n in[x,y]];print ((i-j)*(1+(x-y+0.)/(x-z))/2)+j

Accepts a list of values. Not sure if this can be broken down further. Here it is ungolfed:
def hue(color):
 rgb=color[:]  # copy list
 color.sort()  # sort list
 color=color[::-1]  # reverse sort
 x,y,z=color   # pull out x,y,z

 # The line
 #   i,j=[120if n==r[1]else 240if n==r[2]else 0if z==r[2]else 360for n in[x,y]]
 # is basically the following, twice, once for x/hx and the second time for y/hy

 if x==rgb[1]: # if x is green
  hx = 120
 else:
  if x==rgb[2]: # if x is blue
   hx = 240
  else:
   if z==rgb[2]: # if z is blue and x is red
    hx = 0
   else:       # if x is red and y is blue
    hx = 1

 print ((hx-hy)*(1+(x-y+0.)/(x-z))/2)+hy  # calculate, print

JavaScript 108
Alternate method.
function H(r,g,b){a=[r,g,b].sort(),M=a[2],c=M-a[0],h=M==r?(g-b)/c%6:M==g?(b-r)/c+2:(r-g)/c+4
return h*60|0;}

JavaScript 194
Using the example method.

Array.prototype.i=[].indexOf
function H(r,g,b,a){a=[r,g,b].sort(),i=[a.i(r),a.i(g),a.i(b)],x=[i[2]?360:0,120,240],hx=x[i.i(2)]|0,hy=x[i.i(1)]|0
return (hx-hy)*(1+(a[2]-a[1])/(a[2]-a[0]))/2+hy|0}

var input = document.getElementById("input").innerHTML;
var output = document.getElementById("output");
var html = "";

input.replace(/(\d+)\,(\d+)\,(\d+)/g, function(m, r, g, b) {
  html += H(r, g, b) + "\n";
});

output.innerHTML = html;

0,182,255
127,247,103
0,0,1
255,165,245


text:
Road painting ahead
Given two parameters lane pattern and road length, print an ASCII representation of the lane markings for Roads and Traffic Service to paint the roads.
Example input/output
Input: BTHMLRPHU, 21
I don't care if you take two parameters or concatenate the number onto the end of the string, it's unambiguous.
Input may be taken from STDIN, as a function argument, environment variables, whatever makes sense in your language.
Output:
!   |      x      ##      |      |      x      x      !
! B |  /\  x HOV3 ##  <-  |  ->  |  ^^  x HOV3 x      !
! B |  \/  x HOV3 ##   |  |  |   |  ^^  x HOV3 x      !
!   |      x      ##      |      |      x      x      !
!   |      x      ##      |      |      x      x      !
!   |      |      ##      |      |      |      |      !
!   |      |      ##      |      |      |      |      !
!   |      |      ##      |      |      |      |      !
! B |  /\  | HOV3 ##  <-  |  ->  |  ^^  | HOV3 |      !
! B |  \/  | HOV3 ##   |  |  |   |  ^^  | HOV3 |      !
!   |      x      ##      |      |      x      x      !
! B |  /\  x HOV3 ##  <-  |  ->  |  ^^  x HOV3 x      !
! B |  \/  x HOV3 ##   |  |  |   |  ^^  x HOV3 x      !
!   |      x      ##      |      |      x      x      !
!   |      x      ##      |      |      x      x      !
!   |      |      ##      |      |      |      |      !
!   |      |      ##      |      |      |      |      !
!   |      |      ##      |      |      |      |      !
! B |  /\  | HOV3 ##  <-  |  ->  |  ^^  | HOV3 |      !
! B |  \/  | HOV3 ##   |  |  |   |  ^^  | HOV3 |      !
!   |      x      ##      |      |      x      x      !

Each character denotes 0.5 metres in width and one kilometre in length.
Specification
Lane markings
For every 10 km stretch of road, markings are painted at kilometres 2, 3, 9 and 10 (from the "top" of the output). Markings are centred in the lane. With the exception of the bike lane and median, all lanes are 3 metres (6 characters) wide.
ASCII diamond and arrow characters are not permitted in lieu of the markings as indicated in the example output.

B: Bike lane. B marking. 1.5 metres (3 characters) wide.
T: Transit. Diamond marking
H: High-occupancy vehicle lane. HOV3 marking
L and R: Turning lane. Arrow marking
P: Passing lane. Caret markings
U: Unrestricted lane. No markings

Separators (in order of precedence)

Median: ## (denoted by M in the input string, replaces any other separator including ditch)
Ditch (extreme left and extreme right): ! Exclamation mark
HOV lanes alternate between x and | every 5 km
Normal: |

Constraints
Your function or program must:

Print to STDOUT (this means equivalents of System.out.print for Java, console.log for JavaScript, etc.)
Be able to print 1 - 9 lanes with 0 - 10 medians
Be able to print up to 50 km of roadway (50 lines of output)
Not use any standard loopholes
Trailing white space is not acceptable with the exception of an optional \n at the end of the output

Largest possible output: 3700 bytes (74 characters * 50 lines).
Smallest possible output: 5 bytes (with input B, 1)
Assumptions

No adjacent medians (substring MM will not occur)
The second line of markings might be cut off (for example if the length is 9 or 12 km)
Lanes may not logically make sense (any order is possible, for example a right turn lane on the left of the road)

This is code-golf, so shortest code (in bytes) wins!

And there, you loves monospaced fonts

Ruby, 245
Print the lane divides if relevant, then print the lane.
I don't expect to win.
->(n,i){i.times{|d,t|*e=''
g=e+%w{HOV3 ^^ B}
n.chars{|c|$><<(c==?M?'##':!t ??!:(t+c)[?H]&&d%10<5??x:?|)if(M=t!=?M)
$><<((e+[(%w{/\\ <- ->}+g)[v='TLRUHPB'.index(c)],(%w{\\/ \ | |\ }+g)[v]]+e*4)*2)[d%10].center(v>5?3:6)if(t=c)!=?M}
puts M ? e:?!}}

Changelog
245 choke stderr and split arrays effectively.
263 better way to index array
268 just print each line, don't calculate a canonical version.
330 initial commit

I wouldn't expect Ruby to win either but if there aren't any other answers within the next week then I guess you win :-P On a second note is there anywhere I can test this without installing Ruby on my computer?

@rink.attendant.6 http://ideone.com/

JavaScript (ES6), 316 bytes
f=(x,n)=>{for(i=0;n>i++;){b=!(r=i%10)|r==3;y=[...`! ${[...x].join` | `} !`[o='replace'](/[\W] ?M [\W]?/g,'##')].map(c=>~(q='LPRTU'.indexOf(c))?` ${'<- |^^^^->| /\\\\/    '.substr(4*q+2*b,2)} `:c=='H'?'HOV3':c).join``;y=r&&r<6?y[o](/\| H/g,'x H')[o](/3 \|/g,'3 x'):y;console.log(b|r==2|r==9?y:y[o](/[^!\|x#]/g,' '))}}

Demo
It should work in Firefox and Edge at time of writing, Chrome/Opera require experimental features to be enabled.

console.log = x => O.innerHTML += x + '\n';

f = (x, n) => {
  for (i = 0; n > i++;) {
    b = !(r = i % 10) | r == 3;
    y = [...
      `! ${[...x].join` | `} !` [o = 'replace'](/[\W] ?M [\W]?/g, '##')
    ].map(c => ~(q = 'LPRTU'.indexOf(c)) ? ` ${'<- |^^^^->| /\\\\/    '.substr(4*q+2*b,2)} ` : c == 'H' ? 'HOV3' : c).join ``;
    y = r && r < 6 ? y[o](/\| H/g, 'x H')[o](/3 \|/g, '3 x') : y;
    console.log(b | r == 2 | r == 9 ? y : y[o](/[^!\|x#]/g, ' '))
  }
}

// Snippet stuff
var demo = () => {
  O.innerHTML = '';
  document.forms[0].checkValidity() && f(document.getElementById('P').value, document.getElementById('N').valueAsNumber);
};

document.getElementById('P').addEventListener('change', demo);
document.getElementById('N').addEventListener('change', demo);

demo();
<form action='#'>

    Lane pattern:
      <input type=text pattern=^M?([BHLPRTU]M?)+$ maxlength=19 required id=P value=MLTPUMHUTBR>

    Kilometres:
      <input type=number id=N min=1 value=21 max=50 step=1 required>

<output id=O></output>

</form>

05AB1E, 175 174 175 bytes
ðTиDU'|TиX'BŽ5ES©ǝX„\/TbSDVè®ǝ€ºX4×"HOV3"®ǝX'<18SǝX„|-Yè®ǝøJDí'<'>:X'^®ǝ2×'#Tи2×'x5и'|5и«'!Tи)I.•o¤[‹‡•uŽDýSтì€ûŽe1ª904ûª8ª₄Â«ª‡•δ~¬]•2ôDí«Ž
ÿT∍S:ð.ø8ðìÂ‚8:1ðìÂ‚ð:SðT:èεI∍}øJ»

Pretty bad approach, but it works and was fun to make. Can definitely be golfed some more, though.
+1 byte as bug-fix for two adjacent HH lanes.
Try it online.
Explanation:
Step 1: Create all possible lanes with size 10:
ðTи               # Push a space character, repeated 10 times as list
   DU             # And store a copy in variable `X`
'|Tи             '# Push "|", repeated 10 times as list
X                 # Push the list of spaces of variable `X`
 'B              '# Push a "B"
   Ž5E            # Push compressed integer 1289
      S           # Converted to a list of digits: [1,2,8,9]
       ©          # Store it in variable `®` (without popping)
        ǝ         # Replace the spaces in the pushed `X` with the "B" at these (0-based)
                  # indices
X                 # Push `X` again
 „\/              # Push string "\/"
    TbS           # Push 10, converted to binary, as list: [1,0,1,0]
       DV         # Store a copy in variable `Y`
         è        # Index each into this string: ["/","\","/","\"]
          ®       # Push list `®` again ([1,2,8,9])
           ǝ      # And replace the spaces with these characters
            €º    # And then mirror each line (" "→"  "; "/"→"/\"; "\"→"\/")
X                 # Push `X` again
 4×               # Extend each space to four spaces
   "HOV3"         # Push string "HOV3"
         ®ǝ       # And replace the spaces with this string at the indices of `®` again
X                 # Push `X` again
 '<              '# Push string "<"
   18S            # Push 18 as list: [1,8]
      ǝ           # Replace the spaces with "<" at those indices
       X          # Push `X` yet again
        „-|       # Push string "-|"
           Yè     # Use list `Y` ([1,0,1,0]) to index into this string: ["-","|","-","|"]
             ®ǝ   # And replace the spaces at the indices of `®` again
               ø  # Then zip-pair the two lists together
                J # And join each pair of characters to a string
Dí                # Create a copy and reverse each string
  '<'>:           # And replace all "<" with ">"
X'^®ǝ            '# Push `X` with the spaces at indices `®` replaced with "^"
     2×           # Extend each character to size 2
'#Tи             '# Push "#", repeated 10 times as list
    2×            # And extend each character to size 2
'x5и             '# Push "x" repeated 5 times as list
    '|5и         '# Push "|" repeated 5 times as list
        «         # And merge the lists together
'!Tи             '# Push "!", repeated 10 times as list
)                 # And finally wrap all lists of the stack into one big list of lanes

Step 2: Convert the input-string to indices (which we're going to use to index into the list we created in step 1):
I                 # Push the input-string
 .•o¤[‹‡•         # Push compressed string "tlrpbhmu"
         u        # And uppercase it
ŽDý               # Push compressed integer 3567
   S              # Converted to a list of digits: [3,5,6,7]
    тì            # Prepend each with "100": ["1003","1005","1006","1007"]
      €û          # And palindromize each: ["1003001","1005001","1006001","1007001"]
Že1               # Push compressed integer 10201
   ª              # And append it to the list
904ûª             # Push 904 palindromized to "90409", and also append it to the list
8ª                # Append 8 to the list
₄Â                # Push 1000, and bifurcate it (short for Duplicate & Reverse copy)
  «               # Merge them together: "10000001"
   ª              # And also append it to the list
‡                 # Now transliterate all uppercase characters in the input to these numbers
•δ~¬]•            # Push compressed integer 1119188999
      2ô          # Split into parts of size 2: [11,19,18,89,99]
        Dí        # Create a copy, and reverse each item: [11,91,81,98,99]
          «       # And merge the lists together: [11,19,18,89,99,11,91,81,98,99]
Ž\nÿ              # Push compressed integer 19889
    T∍            # Extended to size 10: 1988919889
      S           # As a list of digits: [1,9,8,8,9,1,9,8,8,9]
:                 # Replace all [11,19,18,89,99,11,91,81,98,99] with [1,9,8,8,9,1,9,8,8,9]
                  # in the converted string
ð.ø               # Surround the string with spaces
8ðì               # Push 8 with a prepended space: " 8"
   Â‚             # Bifurcate and pair: [" 8","8 "]
     8:           # And replace all those for 8 in the string
1ðìÂ‚ð:           # Do the same for [" 1","1 "] → " "
S                 # Convert the string to a list of characters (digits and space)
 ðT:              # Replace the spaces for 10

Step 3: we use those indices to index into the list of lanes. And then we convert those list of lanes to the correct output, including extending/shortening them to the size of the integer-input:
è                 # Index the indices in the integer-list into the lanes-list
 ε                # Map over each lane
  I               #  Push the second integer-input
   ∍              #  Extend/shorten each 10-sized lane to this input-size
 }ø               # After the map: zip/transpose; swapping rows/columns
   J              # Join inner list together to a single string
    »             # And then join each string by newlines
                  # (after which the result is output implicitly)

See this 05AB1E tip of mine (sections How to compress strings not part of the dictionary? and How to compress large integers?) to understand why Ž5E is 1289; .•o¤[‹‡• is "tlrpbhmu"; ŽDý is 10201; •δ~¬]• is 1119188999; Ž\nÿ is 19889.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Construct a polynomial with given roots
The challenge is to write the shortest function/program to find a polynomial given the roots. The function or program should take valid input; that is, a list of integers representing the roots of the polynomial, and return valid output.
Output should return a sequence of numbers representing the polynomial.
For example:
2, 3 represents 2x^1 - 3x^0 = 0
1, 6, 1, 8, 0, 3, 3 represents 1x^6 + 6x^5 + 1x^4 + 8x^3 + 0x^2 + 3x^1 + 3x^0 = 0
-1 0 5, -3 represents -1x^3 + 0x^2 + 5x^1 + -3x^0 = 0
I hope you get the idea.
Example Usage
For an input of 1, 2, the output should be 1, -3, 2, which represents the equation 1x^2 + -3x^1 + 2x^0 = 0, or x^2 - 3x + 2 = 0.
For an input of 1, -1, 0, the output should be 1, 0, -1, 0.
For the input, duplicate values should be removed and order does not matter. For example, the result with input 3, 3, 6 should be the same as the result with input 6, 3.
Float arguments are optional.
As this is code golf, the shortest entry in characters wins. Good luck!

"duplicate values should be removed" interesting. I would have said the roots 3,3,6 correspond to the cubic (x-3)(x-3)(x-6) and the roots 3,6 to the quadratic (x-6)(x-3) 2. What does "float arguments are optional" mean? that we can support them only if we want to? Or that they definitely may occur? 3. (in practice only applicable to float arguments) It seems the simplest way to output is to express in monic form (that is, with the term of highest x having a coefficient of 1)

@ steveverrill What I intended was to find the smallest polynomial given a set of solutions, and (x-3)(x-3)(x-6) is larger than (x-6)(x-3). I do see your argument though.

Most [tag:code-golf] contests are scored by bytes and not characters. I would advise the former.  The latter encourages weird base256/unicode compression of the source, which IMO don't really add anything to the contest, and merely serve to obfuscate the code, making less accessible answers, thus decreasing the overall quality of the site. http://meta.codegolf.stackexchange.com/questions/2364/recommend-that-new-users-use-bytes-not-characters

You speak of input and output, and represent them as comma separated strings... is this the format we must use, or can we use, for instance, arrays? [1,2,3] rather than "1, 2, 3"?

what is the size of the largest integer that may appear? otherwise I guess all these answers don't live up to the spec unless they are using big integers

@DigitalTrauma Okay. I'll do so for next time.

@GlenO As long as the data type can be easily interpreted by humans as solutions, I would say that would be fine.

J, 8 bytes
A series of verbs:
|.p.1;~.

Call it like this:
   |.p.1;~. 1 2
1 _3 2

J has a built-in verb p. (Roots). It converts between polynomials like 2 _3 1 (reverse order from the problem) and a multiplier/root pair like (1; 1 2).
From right-to-left, ~. takes the unique elements, 1; pairs the list with 1, meaning we want the smallest integer polynomial, p. does the actual work, and |. reverses the resulting list.

Python 2, 71
P=[1]
for r in set(input()):P=map(lambda a,b:a-r*b,P+[0],[0]+P)
print P

Iteratively updates the polynomial P to add one root at a time. Adding the root r multiplies the polynomial as P*(x-r). This requires shifting the polynomial list P by one index to represent multiplication by x, the subtracting r times the original list. This is handled by shifting a copy of the list, padding with zeroes, and mapping the function a,b -> a-r*b.
To remove duplicate roots, the input is made into a set.
Using reduce turned out one char longer (72):
lambda R:reduce(lambda P,r:map(lambda a,b:a-r*b,P+[0],[0]+P),set(R),[1])

Three lambdas though!

{input()} saves a few chars

@gnibbler I don't think that works; it makes a singleton set of the list or tuple of input elements. Python 3.5 would allow {*_}, but the characters saved are lost in needing to unpack the map.

right I was thinking of Python3, but then you'd also need to eval input anyway.

Haskell, 70
Basically a port of the reduce version of my Python solution.
import Data.List
foldr(\x p->zipWith(\a b->a-b*x)(p++[0])(0:p))[1].nub

I tried to shorten the lambda expression \a b->a-b*x by making it point-free, but best I have is (+).(*(-x)) on switched inputs (thanks to @isaacg), which is the same length.
The lengthy import for nub is for the requirement to ignore duplicate roots. Without it, we'd have 49:
foldr(\x p->zipWith(\a b->a-b*x)(p++[0])(0:p))[1]

Matlab, 56 bytes
Polynomial multiplication is convolution of their coefficients:
function y=f(R)
y=1;for r=unique(R);y=conv(y,[1 -r]);end

Floating-point roots are supported.
Example:
>> f([1 2])
ans =
     1    -3     2
>> f([1 2 1])
ans =
     1    -3     2
>> f([1 2.1 -3.2])
ans =
    1.0000    0.1000   -7.8200    6.7200

Ruby 2.7+, 60 58 57 50 bytes
->i{p=*1;(i&i).map{|x|p<<z=0;p.map!{-x*z+z=_1}};p}

Requires ruby 2.7+ for numbered arguments to work. Based on xnor's python answer
Takes input as an array of roots, and returns an array of coefficients.
Thanks to @Martin Ender for -2 bytes!
Thanks to Lydxn for -1 byte
Thanks to JoKing for -7 bytes.

you can use i.&i here for -1 i think

@Razetime, no, that wouldnt work because technically its i.&(i.map{|x|.......)

Julia, 41 bytes
Note: this is assuming the list is what matters, not the input/output format.
s->foldl((i,j)->[0,i]j+[i,0],1,unique(s))

Pyth, 17 bytes
u-V+G0*LH+0GS{Q]1

17 bytes. A reduce over the input set. +G0 is essentially *x, and *LH+0G is essentially *r, and -V performs element by element subtraction to perform *(x-r).
Demonstration.

Jelly, 3 bytes
QÆṛ

Try it online!
Outputs them in order from the zero coefficient first. +1 byte to go the other way
It would just be a builtin (Æṛ) aside from the fact that duplicates shouldn't matter. Therefore we deduplicate the input first with Q, then use the builtin

CJam, 24 21 bytes
1al~_&{W*1$f*0\+.+}/`

Input format is a list in square brackets (e.g. [1 2]). Output format is the same. This is a full program. It might get slightly shorter if I package it as an anonymous function.
The approach is fairly straightforward: It starts out with 1 for the polynom, which is described by a coefficient array of [1]. It then multiplies it with x - a for each root a. This results in two arrays of coefficients:

One from the multiplication with -a, which simply multiplies each previous coefficient by this value.
One from the multiplication with x, which shifts the array of coefficients by 1, padding the open position with 0.

The two are then combined with a vector addition. I actually don't have to do anything for the second array, since CJam uses remaining array elements of the longer array unchanged if the other array is shorter, so padding the second array with a 0 is redundant.
Try it online
Explanation:
1a      Put starting coefficient array [1] on stack.
l~      Get and interpret input.
_&      Uniquify input array, using setwise and with itself.
{       Loop over roots given in input.
  W*      Negate value.
  1$      Get a copy of current coefficient array to top.
  f*      Multiply all values with root.
  0\+     Add a leading zero to align it for vector addition.
  .+      Vector add for the two coefficient array.
}/      End loop over roots.
`       Convert array to string for output.

Javascript, 121 bytes
r=>{o=[...r,0].fill(0);for(i=2**r.length;i--;)e=r.length,a=r.reduce((a,q,j)=>a*(i&1<<j?q:(e--,-1)),1),o[e]+=a;return o;}

Explantation
Similar to other answers, we imagine a polynomial of the form:
 (r_1 - x) * (r_2 - x) * ... * (r_n - x)

And we want to multiply it out to get the polynomial:
 a_0 * x^n + ... + a_n * x^0

This program does that by looping over every permutation of the input brackets. We can do this by counting in binary from 0 to 2^n. The i-th bit of that count tells us whether to multiply by r_i, or by -x.
Ungolfed:
function make_poly(roots) {
  o = [...roots, 0].fill(0);
  for (i = 0; i < 2 ** roots.length; i++) {
    a = 1;
    t_index = roots.length;
    for (j = 0; j < roots.length; j++) {
      if (i & (1 << j)) {
        a *= roots[j];
      } else {
        a *= -1;
        t_index--;
      }
    }
    o[t_index] += a;
  }
  return o;
}

It's “polynomial”, not “polygon” ;)

Oops, thanks! Been thinking about polygons too much recently.

Husk, 13 bytes
FȯmΣ∂Ṫ*moe1_u

Try it online!
Explanation
The idea is to generate the polynomials (x-r0),…,(x-rN) for the roots r0,…,rN and simply multiply them out:
F(mΣ∂Ṫ*)m(e1_)u  -- accepts a list of roots, example: [-1,1,-1]
              u  -- remove duplicates: [-1,1]
        m(   )   -- map the following (eg. on 1):
            _    --   negate: -1
          e1     --   create list together with 1: [1,-1]
F(     )         -- fold the following function (which does polynomial multiplication),
                 -- one step with [1,-1] and [1,1]:
     Ṫ*          --   compute outer product: [[1,1],[-1,-1]]
    ∂            --   diagonals: [[1],[1,-1],[-1]]
  mΣ             --   map sum: [1,0,1]

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Hard Puzzle Game Solver
There is an app called Hard Puzzle which is a game where there is a red circle, and you have to fill all of the surface area with five smaller white circles
it may seen easy, but it's harder than it looks (it just takes a while to figure out). The circle dimensions change from device to device in the image above the red circles area is 41990 pixels although on my device it is 40496 pixels this is not important though.
So the challenge is to create the fastest algorithm (in any language) that solves this puzzle, by outputting the coordinates of where each white circle should be. Puzzle info: Red circle area = 40496 pixels. each white circle's area = 15656 pixels (38.661% of red circle)
Your time starts now there is 3 days for completion of the task
GO!!

Can you specify the input and output of the program? Are the circle sizes fixed? If there is one optimal solution, would it be sufficient to write a program that outputs that solution?

@agtoever the sizes are fixed and the program outputs the solution

@flint In what format should the solution be output? Graphical, or a list of coordinates of circle centers? If graphical, does every pixel need to be correct? If textual, what's to keep us from just hardcoding the points? What counts as an "algorithm"?

@flint Note that GolfScript, being a code golf language (not even the best one, but that's besides the point) is designed for concise code, not speed, so it would easily lose to almost any general-purpose language; also note that disallowing a specific language in any challenge is frowned upon.

@ThomasKwa the output is list of coordinates.

Python 2.7, runs almost instantly (0.02 seconds on my laptop)
import math, cProfile

def optimize():
    _WHITE_SURFACE = 15656
    white_radius = math.sqrt(_WHITE_SURFACE/math.pi)
    print "Assuming the red circle has its centre at (0,0), place the white circles at (x,y):"
    for i in range(5):
        print "   * Circle {0}: ({1:.5f}, {2:.5f})".format(i+1, white_radius*math.cos(i*math.pi/2.5), white_radius*math.sin(i*math.pi/2.5))

cProfile.run("optimize()")


text:
Fixing a logic system
You are given a set of logic statements. Your challenge is to remove any ones that contradict the others, but in the optimal way (i.e. removing a minimal number of statements).
Challenge
You will write a program or a function that takes as input a list of statements, removes the minimal number of statements such that there is a solution and outputs the rest.
Logic
Statements consist of variables A-Z and operators between them.
There are 5 operators: - (not), v (or), ^ (and), -> (if) and <-> (iff).
Truth table:
A | B | -A | AvB | A^B | A->B | A<->B
0 | 0 |  1 |  0  |  0  |   1  |   1
0 | 1 |  1 |  1  |  0  |   1  |   0
1 | 0 |  0 |  1  |  0  |   0  |   0
1 | 1 |  0 |  1  |  1  |   1  |   1

These operators can be combined together with parenthesis ():
A | B | -(AvB) | Av(-A) | A^(-A) | (AvB)->(-B)
0 | 0 |    1   |    1   |    0   |      1
0 | 1 |    0   |    1   |    0   |      0
1 | 0 |    0   |    1   |    0   |      1
1 | 1 |    0   |    1   |    0   |      0

Logic systems consist of 1 or more statements.
A solution to the logic system is a state where all of the statements are simultaneously true.
Examples of logic systems:
AvB
-(A<->B)
(AvB)->(-B)

The only solution is A = 1, B = 0.
A^B
-(B<->A)

This one has no solution; with no combination of A and B both of the statements are true.
Input
You will receive a set of statements as input. This can be taken via STDIN or function arguments, formatted as an array (in a convenient format) or a newline-separated or space-separated string.
The statements will be of the following form (in almost-ABNF):
statement        = variable / operation
operation        = not-operation / binary-operation
not-operation    = "-" operand
binary-operation = operand binary-operator operand
operand          = variable / "(" operation ")"
variable         = "A"-"Z"
binary-operator  = "v" / "^" / "->" / "<->"

Example statements:
A
Av(-B)
(A<->(Q^C))v((-B)vH)

Output
You must return the (possibly) reduced set of statements, in the exact form you received them. Again, the list can be formatted as an array of strings or a newline-separated or space-separated string.
Rules

You should always remove the minimal number of statements. If there are multiple possible solutions, output one of them.
You may assume that the input always contains at least 1 statement and that no statements are repeated in the input.
You may not assume that the output always contains a statement. (see examples)
Using standard loopholes contradicts with your answer being valid, and one of them must be removed.
This is code-golf, so the shortest answer in bytes wins.

Examples
Input:
A^(-A)

Output:
(nothing)

Input:
A^B A<->(-B) A<->B

Output:
A^B A<->B

Input:
["AvB","A^B"]

Output:
["AvB","A^B"]

I don't know if this is relevant, but this problem comes down to maximum set packing, which is NP-complete.

According to your grammar, the third statement in the example is not correct ((AvB)->-B should be (AvB)->(-B))

@proudhaskeller Thanks, corrected that.

also, parentheses in A<->(Q^C))v((-B)vH are mish-mashed.

Ruby, 299 298 283 279 bytes
class Object;def * o;!self|o;end;def s;w=join.gsub(/\W/,"").chars.uniq;n=w.size;(0..2**n).any?{|i|n.times{|j|eval(w[j]+"=#{i[j]>0}")};all?{|e|eval([%w[<-> ==],%w[-> *],%w[- !],%w[^ &],%w[v |]].inject(e){|x,i|x.gsub(*i)})}}?self:combination(size-1).map(&:s).max_by(&:size);end;end

Expects an array of expressions.
If you're going to run it, set $VERBOSE=nil from inside ruby so you don't get lots of warnings about redefining constants.
Note that it actually sets the variable "v" as well but it doesn't make a difference.
Uses truth values because they have all of the required operators already, except implication. Unfortunately Ruby doesn't have a boolean class so we have to monkey-patch Object to get implication :)
Could make it shorter if we just set ALL of the uppercase variables, but then it would take a huge amount of time to run. Should probably have a caveat in the question about that.

Ungolfed:
class Object
  def * o
    !self|o
  end
end

def sat? exs
  #exs: an array of expressions
  s=[%w[<-> ==], %w[-> *], "-!", "^&", %w[v ||]]

  w=exs.join.gsub(/\W/,"").chars.uniq #variable names
  n=w.size
  if (0...2**n).any? {|i|
    n.times do |vi|
      eval("#{w[vi]}=#{i[vi]==1}")
    end
    exs.all?{|ex|eval(s.inject(ex){|x,i|x.gsub(i[0],i[1])})}
  }
    exs
  else
    exs.combination(exs.size-1).map{|sm|sat?(sm)}.max_by(&:size)
  end
end

Python 3, 431 bytes
Not very golfed right now, but I figure I'd get the ball rolling with an answer. Try it here, g() is the main function.
import re,itertools as H
def g(i):
 y=re.sub(r'\W','',''.join(set(i)).upper());l=i.split()
 def e(s):
  def f(a):
   for v,w in a:exec(v+'='+w)
   return eval(re.sub('[^A-Z()]+',lambda x:{'v':' or ','^':'*','<->':'==','->':'<=','-':'not '}[x.group()],s))
  return[c for c in H.product("01",repeat=len(y))if f(zip(y,c))]
 for n in range(len(l),-1,-1):
  for q in H.combinations(l,n):
   if e('('+')^('.join(q)+')'):return' '.join(q)

Very cool. I got it down to 428: http://repl.it/BCzp

There is a problem with the way you are modeling truth values. For example, g("A (AvA)<->A") should give back its input, but it doesn't work because if A=1, then AvA=2.

Aha, you're right, thanks for pointing that out. Reverted it back to " and " for now since I couldn't think of a shorter way to compare them. Also thanks for the golfing changes Pietu!

I believe v is or.