text:
2016 Time Capsule String: Climb The Integer Ladder
Using the 74 characters from the 2016 time capsule string
H@~*^)$.`~+1A|Q)p~`\Z!IQ~e:O.~@``#|9@)Tf\eT`=(!``|`~!y!`) Q~$x.4|m4~~&!L{%

write N code snippets all in the same language where:

The 1st snippet outputs 1.
The 2nd snippet outputs 2.
The 3rd snippet outputs 3.
... etc. ...
The Nth snippet outputs N (the number, not the literal letter).

A "code snippet" is defined as any of these:

A full program with no required input that outputs the number normally.
A function with no required arguments that outputs/returns the number normally.
A REPL expression that evaluates to the number.

(You may mix and match these three variants in your N snippets.)
The characters you're allowed to use in the combined set of N snippets are precisely the 74 characters of the time capsule, plus floor(N/2) extra "wildcard" bytes that you may use anywhere.
For example, the time capsule contains three @'s so in the entirety of your N snippets there may only be up to three @'s present unless you decide to use some of your floor(N/2) wildcard bytes for additional @'s.
Thus, not counting wildcards, the combined set of characters in your N snippets must be a subset of the 74 time capsule characters. Their combined lengths cannot exceed 74.
You may not reuse time capsule characters or wildcard bytes between snippets.
Notes

The are no other limits on snippet length or how many wildcards may be used per snippet.

You must write all snippets for 1 through N. It's not 0 to N-1, not k to N+k-1.

The snippets must be individual, not one snippet that outputs the  list 1, 2, 3, ..., N.

Outputs may be floats like 3.0 in place of 3 and you can use a base other than decimal if it is your language's natural base. You must use the same base for all snippets.

The wildcards are counted as bytes in your language's encoding. This will probably be ASCII but e.g. if ∞ counts as one byte in your encoding then you can use it as a single wildcard byte.

You may use wildcard bytes for multibyte characters. e.g. ∞ is normally three bytes so you could use it in a snippet but it will cost three of your floor(N/2) wildcard bytes.

Newlines such as \r\n may be considered one byte.

Example
In Python, N = 4 is possible just using the REPL. There are floor(4/2) = 2 wildcards.

1 from the time capsule is an expression that evals to 1.

2 consists of a single wildcard, namely the 2. Evals to 2.

3 also consists of a single wildcard. Evals to 3. No more wildcards.

4 is luckily in the time capsule and it evals to 4.

These snippets are short and trivial. A real answer would likely be much more complex.
(Five and beyond in Python may certainly be possible but I'll leave it to the professionals.)
Scoring
The answer with the highest N wins; i.e. the one that climbs the integer ladder the highest.
In case of a tie, the answer that used the fewest wildcard bytes wins.
In case there is still a tie, the answer that used the fewest cumulative characters wins.
If there is still a tie, the earlier answer wins.

If a programming language doesn't have a REPL, can we still submit an expression in that language if it evaluates to the appropriate value? (For example, is 4 a valid snippet that returns 4, in older versions of Perl which have no REPL?)

Oh, and another question: in a language with a non-ASCII-compatible encoding, do we treat the time capsule characters as characters (translating them to the language's encoding), or as bytes (writing a program such that viewing the program as ASCII would appear to be contained entirely of time capsule characters)? In some languages with weird character sets, most of the time capsule characters aren't even in the character set, which makes them hard to use as-is.

What about leading zeroes? Is 07  the same as 7?

It is really bugging me that the string contains neither - nor n...

Can "snippets" in stack-based languages leave their values on the stack?

@ais523 (1) I'll say no since it's less clear what "expression" means there and more difficult to test. (Maybe ask on meta about this.) (2) Treat the capsule characters as characters, not code points and not necessarily single bytes (depends on encoding). If your language doesn't support the time capsule characters, tough luck.

@Emigna That sound ok, yes.

Yes, according to http://meta.codegolf.stackexchange.com/a/8507/26997

CJam, 23 snippets, 11 wildcards, 45 bytes
Q!
Q!)
Z
4
4)
6
7
8
9
A
B
C
D
E
F
G
H
I
J
QT|T+e`
O!)1
L!`e`(:)
6mf

Try it online! | wildcard counter (ignore the newlines)

CJam, 25 snippets, 12 wildcards, 64 bytes
1
Q!)
Z
4
5
6
L``(*$)#
8
9
T!T
B
C
D
E
F
G
H
I
J
K
O`e`~~!!
B`:)
Q``$e`~~@~@=~+
Q!)4
Amf

Try it online!
Wildcards:
568BBCDEFGJK

I feel that I have to post quickly, before Dennis outgolfing me.

Which wildcards did you use?

@EasterlyIrk Edit. You can also use the wildcard counter in Dennis's answer.

Work in progress: https://tio.run/nexus/jelly#FczNCoJAFIbh/XcVDVo4SYJgPwrCWJlaggy4Eomz0Z3Qsmg4N9E1dV2TLd/F89rvZ6OstSG0kOhQE7nSwRY77HFAjAxHnHBGjgsKlKhwxQ0NDcQsBKJphJ7NPxWrlP15xB5HyCmRKKg1bHrZ21Lx@i7dgNgPM6Plg6nvRKV5SJqAFZFjYiXbsR9aSj1BZIjFS5BcaHafQWSmiHkl6vfyBw

JavaScript, 10 numbers, 5 wildcards
Remaining characters:  !!#$$%&())))*...:=@@@HILOQQQTTZ\^```eefmpy{|||~~~~~~~~~
5/5 bonus characters used: 37680
Programs:

1
!``+!``

3
4
4|!``
6
7
8
9
0xA

I had hoped one of the strings I could make using \xAB would be a number, but unfortunately none of the combinations I tried would yield any. The ^ (XOR) character would also be interesting to use, but I currently don't see any opportunities where it can be used to make a great enough number.
If you see another feasible combination, let me know in the comments.
Edit: Added #10 thanks to Arnauld

I think you can add 10. 0xA (with 0 being a new wildcard granted for reaching 10)

You can do (Q=!``)|Q for 1 to get an extra 1 somewhere. Not sure if that'll help though

Pyth, 12 snippets, 20 bytes (6 wildcards)
f@

Find the first number where root(n,n) is truthy, starting from 1.
Output: 1
y!H

Double not {}.
Output: 2
3

Wildcard #1.
Output: 3
4

Output: 4.
5

Wildcard #2.
Output: 5
6

Wildcard #3.
Output: 6
7

Wildcard #4.
Output: 7
8

Wildcard #5.
Output: 8
9

Output: 9
T

Preinitialized variable.
Output: 10
+T!Z

Ten plus not zero.
Output: 11
12

Wildcard #6 (2).
Output: 12

Octave, 6 numbers, 3 wildcards
1: ~~I          % not(not(sqrt(-1))) evaluates to true (or 1)
2: 2            % Wildcard
3: 3            % Wildcard
4: 4
5: (T=4)+~~T    % Create a variable T=4, then add not(not(T)) which evaluates to 1.
6: 6            % Wildcard

I still have 1, 9 and * left, but I don't know if it will help me much. I'll see what I can do with those :)
Not easy getting many numbers when not using an Esolang. I'm hoping I'll be able to get one or two more, but I think it'll be hard.

Pushy, 10 numbers (4 wildcards)
All of these are snippets which leave the result on the stack. You can test this in the online interpreter by appending # to each snippet (to print the number)
A(      \ 1:  Get alphabet and check that 'Z' >= 'Y'. Results in 1 (True)
x&+     \ 2:  Check stack equality (True - both are empty) then duplicate and sum.
3       \ 3:  Push 3 (1 wildcard)
4       \ 4:  Push 4
1 4+    \ 5:  1 + 4 in postfix, leaves 5 on the stack (1 wildcard)
`L`T%   \ 6:  Get character code of 'L' and modulo by T (ten) - leaves 6 on the stack
7       \ 7:  Push 7 (1 wildcard)
8       \ 8:  Push 8 (1 wildcard)
9       \ 9:  Push 9
T       \ 10: Push 10

This answer is not yet complete - although it seems unlikely I will get much further.

05AB1E, 12 numbers, 6 wildcards
 1:    1                                   -> 1
 2:    )O!x                                -> sum([])!*2
 3:    4L`\                                -> 2nd_last(range(1...4))
 4:    4                                   -> 4
 5:    5        # wildcard 1 = 5           -> 5
 6:    6        # wildcard 2 = 6           -> 6
 7:    Tf`~                                -> or(last2(prime_factors(10)))
 8:    8        # wildcard 3 = 8           -> 8
 9:    9                                   -> 9
10:    T                                   -> 10
11:    A`Q!T+   # wildcard 4 = T           -> (y==z)!+10
12:    TÌ       # wildcard 5,6 = T,Ì       -> 10+2

Hexagony, 6 numbers, 3 wildcards, 23 bytes
1!@
))!@
)|\@$!
4!%
4)!:
6!@

Try it online!
The entire sixth program is made from wildcards.
The only really interesting one is 3. While I could do that as 4(!@, that would leave me without a 4 to generate 5 easily, so I went with this instead:
 ) |
\ @ $
 ! .

Due to the |, the ) on the first line is run twice, before the IP wraps to right-hand corner. $ skips over the @, and then the \ redirects the IP through the ) a third time. The IP wraps to the bottom left corner, ! prints the 3 and @ terminates the program.
I don't think more than 6 snippets are possible, because there are only 5 printing commands (!!!!!) and 5 commands that can be used to terminate the program (@@@%:). So after the fifth snippet, we need at least two wildcards per snippet. Hence, even if I managed to get 6 without using a wildcard for it, there wouldn't be enough wildcards left to go to snippet seven.

JavaScript, 8 numbers, 4 wildcards
 1: 1
 2: -~!``
 3: 4+~!$
 4: ~!``*~!``
 5: 4|!$
 6: 0xf^9
 7: 7
 8: 8

I might try again later - I'm kind of wasting characters on 2 and 6, when you get down to it.

Befunge-98, 4 snippets, 18 bytes, 2 wildcards
!.@
!:+.@
41-.@    wildcard 1 = -
4.#A9H   wildcard 2 = .

Characters left:  !!!$$%&())))*=ILOQQQTTZ\^`````````eefmpxy{||||~~~~~~~~~
I doubt more are possible, since every extra program will require a form of output, and all ., are already used up. If I can figure out a way to make 3 and 5 without a wildcard, then it's possible.
The last program will eventually terminate due to the stack filling up. A and H with no fingerprints loaded will reflect, and the program will keep pushing 9's.

I don't think the last one is valid. Unless the challenge says otherwise, programs need to terminate.

You can simply terminate with % though.

@MartinEnder 00% is valid in Befunge-98 and results in 0 (or asks the user for the result in Befunge-93.

@MartinEnder Also, the last program will eventually terminate assuming finite memory. The Funge-98 spec mentions that { can reverse if it runs out of memory; nothing is said about normal pushing, and all interpreters seem to fail on OOM, but clearly memory limits are thought about in the language spec.

I think this could potentially be improved upon (maybe???) due to the presence of the p character, but it would take some work. You could do e%9 to get 5, but you would need a way to both print it and end the program, so i doubt it

Nevermind, for some reason I thought those backticks were 's. There aren't enough push operations or math operators to eek out another . or , with put.

SmileBASIC, 12 snippets, 5 wildcards, 31 bytes
!.     '. is parsed as the number 0.0; taking the logical not gives 1
!.+!.  'Previous value added to itself
@Q||Q  '@Q is a label string and Q is a variable. For some reason, certain comparison/logical operations between strings and numbers return 3 rather than 1 or 0.
4      '4
#TLIme 'Constant for the text color lime green, value is 5.
6      '6 (wildcard)
7      '7 (wildcard)
8      '8 (wildcard)
9      '9
&HA    'Hexadecimal A
11     '11 (one of them is a wildcard)
4*3    '4 multiplied by 3 (3 is wildcard)

I could've also used a variable instead of . (variables start at 0), and a string variable (like Q$) instead of @Q
Characters used: !!!#&*+...1449@AHILQQTem||
Wildcards used: 67813
unused characters:  !!$$%()))):=@@OQTZ\\^`````````efpxy{||~~~~~~~~~


text:
Compose a Song!
Preface
The available keys are the keys of the A through G and A minor through G minor.
The Challenge
Create a program that creates and saves to a playable audio file a "song" of using (uniformly distributed) random chords. The song must be of length n and in key k. The chords in each "song" must conform to the key. If you don't know what belongs in a particular key, the image below may help.

Rules and Guidelines

Must conform to key

Chords must be chosen randomly with even distribution

Assume each chord is held for 1 beat in 4:4 time at 120 bpm, therefore each chord lasts .5 seconds

The same chord is allowed to be selected multiple times in a row, though it must be randomly

The program should theoretically be able to generate a "song" of any positive time value

Assume n > 1 in all cases

Input will be a length n (in seconds) and a key k as a major or minor key A, Amin, B, Bmin, etc

Output must be in the form of a playable audio file

Examples (as strings)
[key], [length] -> [output]

C, 1 -> Dmin, F

B, 6 -> D# min, C# min, F#, G# min, E, B, F#, C# min, C# min, D# min, E, G# min

Alright, what's the audio output library with the shortest function names... starts googling

@Blacksilver I live to torture golfers (;

If I chose to implement the correct chords instead of defaulting to no accidentals, would that still be a valid submission?

@PatrickRoberts go for it!

Using no accidentals for the root note of the chords does NOT allow you to ignore accidentals. Taking your second example, we have Dmin D F A, Cmin C Eb G, F F A C, Gmin G Bb D E E G# B, B B D# F#, F F A C etc, ie alternating between the keys of Bmajor/G#minor (5 sharps) and Bb major/Gminor (2 flats.) If you allow ALL notes to be non-accidentals, you effectively restrict the problem to the key of Cmaj. I think you need to think about that rule 2 again. It's totally at odds with rule 1 which says must conform with the key as much as possible (which by the way is too vague.)

@LevelRiverSt fixed. The limitation made more sense in my mind

OK, looking much better. One more thing: It's not clear to me why you've included both major and minor scales. You haven´t specified a way to differentiate between them in the input, so I would think it is best to stick to major. Cmaj and Amin (for example) form a pair with exactly the same notes. Otherwise you need to specify how to differentiate in the input.

Finally, the audio file rule is OK, but I would like it if the program could be allowed to play the music directly :-)

@LevelRiverSt I considered that, however I would like to be able to save samples in case something interesting occurs. With being played directly if some curious sequence happens there is no way I can replicate it. Also. Working on the input

JavaScript (ES6) + synth-js, 303 bytes
k=>l=>eval("for(m=/(.)(#?)(m?)/.exec(k),W=synth.WAV,w=new W,g=m[3]?[2,1,2,2,1,3,1]:[2,2,1,2,2,2,1],s=W.semitone(m[1]+4+m[2]),n=0;n<l*2;n++)for(r=Math.random()*7|0,c=i=g.reduce((u,h,j)=>u+(j<r)*h,0);c-i<12;c+=g[r++%7]+g[r++%7])w.writeNote({note:W.note(s+c),time:.5,amplitude:.25},[],1,c-i<9);w.toBlob()")

De-obfuscated:
(key) => (length) => {
  let match = /(.)(#?)(m?)/.exec(key),
      W = synth.WAV,
      wav = new W,
      // if minor, use minor gaps else major gaps
      gaps = match[3] ? [2, 1, 2, 2, 1, 3, 1] : [2, 2, 1, 2, 2, 2, 1],
      // get semitone index of scale root
      semitone = W.semitone(match[1] + 4 + match[2]);

  // 2 notes per second
  for (let note = 0; note < length * 2; note++) {

        // choose 1 of 7 random chords
    let random = Math.random() * 7 | 0,
        // get number of half steps from scale root to chord root
        initial = gaps.reduce(
          (sum, half, index) => sum + (index < random) * half,
        0);

    // of every tetrad, maximum of 11 half steps from root to 4th is possible
    // tetrads composed of thirds, so add two gaps for every increment
    for (let current = initial; current - initial < 12; current += gaps[random++ % 7] + gaps[random++ % 7]) {

      // write note data as binary
      wav.writeNote({note: W.note(semitone + current), time: .5, amplitude: .25}, [], 1, current - initial < 9);
    }
  }

  // return blob of wav binary data
  return wav.toBlob();
}

For those of you who might ask "Why isn't new Audio(URL.createObjectURL(...)) part of your byte-count?", according to MDN:

A Blob object represents a file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system.

Since this function returns a Blob with MIME-type audio/wav, it qualifies as a "playable audio file" as requested in the specification for the challenge.
Demo:

f=
k=>l=>eval("for(m=/(.)(#?)(m?)/.exec(k),W=synth.WAV,w=new W,g=m[3]?[2,1,2,2,1,3,1]:[2,2,1,2,2,2,1],s=W.semitone(m[1]+4+m[2]),n=0;n<l*2;n++)for(r=Math.random()*7|0,c=i=g.reduce((u,h,j)=>u+(j<r)*h,0);c-i<12;c+=g[r++%7]+g[r++%7])w.writeNote({note:W.note(s+c),time:.5,amplitude:.25},[],1,c-i<9);w.toBlob()")

h=
()=>new Audio(URL.createObjectURL(f(k.value)(l.value))).play()
<script src=//unpkg.com/synth-js/dst/synth.min.js></script>
<input id=k value=B>
<input id=l value=1>
<button type=button onclick=h()>Play</button>

If you want to verify that all chords which can be randomly chosen are correct, here is a table of all possible chords below, given valid input:

function markup(key) {
  let match = /(.)(#?)(m?)/.exec(key),
      numerals = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII'],
      gaps = match[3] ? [2,1,2,2,1,3,1] : [2,2,1,2,2,2,1],
      semitone = synth.WAV.semitone(match[1] + 4 + match[2]),
      string = '  ' + key + ':\n';

  for (let root = 0; root < 7; root++) {

    let initial = gaps.reduce(
          (sum, half, index) => sum + (index < root) * half,
        0),
        index = root;

    string += '    ' + numerals[root] + ': ';

    for (let current = initial; current - initial < 12; current += gaps[index++ % 7] + gaps[index++ % 7]) {

      string += synth.WAV.note(semitone + current) + ' ';
    }

    string += '\n';
  }

  string += '\n';

  return string;
}

let keys = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'];
let html = '<pre>';

html += 'Major Scales:\n';

keys.forEach(key => {
  html += markup(key);
});

html += 'Minor Scales:\n';

keys.forEach(key => {
  html += markup(key + 'm');
});

html += '</pre>';

document.write(html);
<script src=//unpkg.com/synth-js/dst/synth.min.js></script>

Why is this noncompeting?

@ConorO'Brien "...but is unfortunately non-competing because it relies on a utility which I have yet to officially publish." The dependency for it was technically written after the challenge was posted, which I was under the impression deemed the answer as unable to compete.

Just to clarify, the updated library has been on my computer for a couple months, I just haven't uploaded the class until I wrote my answer because I've been working on cleaning the code and writing up documentation.

@PatrickRoberts Would it be ok if i added this jsfiddle: https://jsfiddle.net/v098s9u6/

@Caleb that's kind of the point of the stack snippet I already have for the demo.. why do you want to add the jsfiddle?

@PatrickRoberts just to have an easy-run copy, either way its your preference i was just suggesting

source: Stack Exchange

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

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

sort: votes


text:
Find the smallest positive integer which has all integers from 1 to n as factors
The question's pretty much described by the title: write a program or function that takes a positive integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to n.)
This is a code-golf challenge, so the shortest entry in bytes wins.
Inspired by this challenge. (This challenge is basically the inverse of that one.)
Test cases

Input: 1; Output: 1
Input: 6; Output: 60
Input: 19; Output: 232792560
Input: 22; Output: 232792560

You don't need to worry about integer precision issues (unless your language has integers so small that this would trivialise the problem). If your language does have bignums, though, you might also want to test your program on this case, just for fun:

Input: 128; Output: 13353756090997411579403749204440236542538872688049072000

Could you add some test cases?

I remember golfing this precise task and have code already written for it in a file created in August, but I can't find a dupe.

@Zgarb: I've added some cases as you requested.

@xnor Related

I take it the input is positive?

@xnor: Edited to clarify. (The question doesn't make much sense with negative/zero inputs anyway.)

Was this from this sandbox post

This was "sandboxed" in chat, rather than on Meta. I searched for duplicates and failed to find them, although this is partly because a) I wasn't thinking of it as a lowest common multiple question when I asked it, and b) the original duplicate question doesn't actually use the words "lowest" (or "least") common multiple (it's hyphenated). I agree it's a duplicate, though; at this point the correct fix is probably an answer merge, but I don't have the permissions to do that so I'll close it as duplicate in the meantime.

I've now edited the older post asking the same question so that it actually contains words that would make it show up on searches. (Insert famous quote about how users keep finding ways to ask the same question in two different ways with no words in common…)

@FlipTack I made that sandbox post, but felt it was a duplicate of Mego's question. I was wrong, thought I should post it anyway, and then found this. Turns out it IS a dupe, but not of Mego's Q.

Python, 46 bytes
g=lambda n,c=0:n<1or(c%n<1)*c or g(n,c+g(n-1))

Take that, past xnor!

50 bytes:
g=lambda n,i=1:n<1or(i*n%g(n-1)<1)*i*n or g(n,i+1)

I apparently golfed this problem 5 months ago, and I don't remember how this code works or why I golfed it. I think I have a golfing problem.
(Edit: It's from this answer. Thanks to Dennis for inspiring the solution and saving 4 bytes.)
Apparently, this code recursively finds lcm(1..n) as lcm(lcm(1..n-1),n). So, the function g expresses g(n) as the smallest positive multiple i*n of n that's also a multiple of g(n-1). (It could instead search multiples of g(n-1) for multiples of n, but this is golfier because g(n-1) only needs to be referenced once. Thanks to Dennis for this improvement.)
Here's the rest of the file, full of other golfing attempts:
f=lambda a,b:a and f(b%a,a)or b
g=lambda n:reduce(lambda a,b:a*b/f(a,b),range(1,n+1))

f=lambda a,b:a and f(b%a,a)or b
g=lambda n:n==1 or n*g(n-1)/f(n,g(n-1))

import math
g=lambda n:n==1 or n*g(n-1)/math.gcd(n,g(n-1))

g=lambda n,k=1:k*all(k%~i==0for i in range(n))or g(n,k+1)
g=lambda n,k=1:min(k%~i for i in range(n))and g(n,k+1)or k

l=lambda a,b:a%b and l(b,a%b)*a/(a%b)or a
g=lambda n:n<1or l(n,g(n-1))

g=lambda n,i=1:n==0 or (g(n-1)*i if g(n-1)*i%n==0 else g(n,i+1))

g=lambda n,i=1:n<1or g(n-1)*i*(g(n-1)*i%n<1)or g(n,i+1)

g=lambda n,i=1:n<1or(i*g(n-1)%n<1)*i*g(n-1)or g(n,i+1)

g=lambda n,r=1,c=1:r if n<2 else (g(n-1,r,r)if r%n==0 else g(n,r+c,c))

g=lambda n,r=1,c=1:r*(n<1)or r%n and g(n,r+c,c)or g(n-1,r,r)

g=lambda n,i=1:n<1or(i*g(n-1)%n or i)*g(n-1)or g(n,i+1)

def g(n):
 if n==0:return 1
 a=b=g(n-1)
 while b%n:b+=a
 return b

g=lambda n,i=1:n<1or g(n-1)*i%n and g(n,i+1)or g(n-1)*i

g=lambda n:n<1or min(range(n,3**n,n),key=g(n-1).__rmod__)

g=lambda n,i=1:n<1or(i*n%g(n-1)<1)*i*n or g(n,i+1)

r=n=input()
while n:
 c=r
 while r%n:r+=c
 n-=1
print r

r=n=input()
while n:
 c=r
 while r%n:r+=c
 n-=1
print r

r=1
for n in range(input()):
 c=r
 while r%~n:r+=c
print r

r=n=input()
while n:
 exec"r+=c*(r%n>0);"*n
 n-=1;c=r
print r

r=n=input();exec("r+=r%n and c;"*n+"n-=1;c=r;")*n;print r

It's eerie looking at my own past work. In trying to golf it, I keep thinking "maybe I can save some bytes by ..." and then seeing there's already a piece of code that attempted to do just that.
You think you've thought of everything, past xnor? Well, I'll show you!

I might be being stupid, but can't you use | in place of or.

@busukxuan No, or is different from | on integers, a or b equals a if a is nonzero, and otherwise b. I'm using it as a conditional to use the current c only if both nonzero and a multiple of n.

@xnor Oh I see, or on integers is an arithmetic operation huh...

@busukxuan More generally, it's a conditional operation, see the start of this write-up.

I don't think it's a question that you have a golfing problem ;)

I think that the old code originated from here, but I might be wrong :p.

@Adnan Thanks, mystery solved! Funnily enough, searching the exact code didn't find it, whether on SE search, google, or code-searching engines that claim to preserve punctuation. Also unclear why my file was created two months after the post.

05AB1E, 3 bytes
L.¿

Try it online!
Explanation
L     # range [1 ... input]
 .¿   # least common multiple

julia, 11 bytes
n->lcm(1:n)

My first thought was literally "Julia could do it, though I am too lazy to find out enough to actually write a snippet" xP

I am also relatively new to julia:)

Wolfram Language, 20 13 bytes
LCM@@Range@#&

Applies a range from 1 to x, then applies it to LCM. To run this, append [<input>].
7 bytes (!) shaved off by Martin.

It is worth noting that I almost never use this language, so this can almost certainly be golfed.

you can use prefix notation to save two bytes: f@x_:=LCM@@Range@x or define an operator to save another: ±x_:=LCM@@Range@x, but it's usually shortest to use an unnamed function: LCM@@Range@#&.

@MartinEnder So my answer is LCM@@Range@#&? How do I call that?

...&[5] or assign it to a variable f=... and then f[5].

A function using # as variable and ending in & is called a "Pure Function." Here's a good guide on how it works. I recommend changing your answer to LCM@@Range@#& as it is 8 bytes shorter than your version.

Thanks @JungHwanMin, I've been meaning to use this language for a while. All references are welcome!

@JungHwanMin I was in the process of changing it just as you commented that. :P Wanted to verify my code again.

JavaScript (ES6), 54 50 bytes
f=(n,L=1,a=L,b=n)=>n?b?f(n,L,b,a%b):f(n-1,n*L/a):L

Test cases

f=(n,L=1,a=L,b=n)=>n?b?f(n,L,b,a%b):f(n-1,n*L/a):L

console.log( 1, f( 1));
console.log( 6, f( 6));
console.log(19, f(19));
console.log(22, f(22));

PHP, 61 52 48 bytes
saved 9 bytes thanks to @user59178, 4 bytes by merging the loops to one.
Recursion in PHP is bulky due to the function key word; so I use iteration.
And with a "small" trick, I now even beat JS.
while(++$k%++$i?$i>$argv[1]?0:$i=1:$k--);echo$k;

takes input from command line argument. Run with -r.
breakdown
while(++$k%++$i?    # loop $i up; if it does not divide $k
    $i>$argv[1]?0       # break when $i is larger than input
    :$i=1               # while not, reset $i and continue loop with incremented $k
    :$k--);         # undo increment while $i divides $k
echo$k;         # print $k

ungolfed
That´s actually two loops in one:
while($i<=$argv[1])     # break when $i (the lowest non-divisor of $k) is >input
    for($k++,           # loop $k up from 1
        $i=0;$k%++$i<1;);   # loop $i up from 1 while it divides $k
echo$k;                 # print $k

You can save 9 bytes by moving the $k++ into the setup for the inner loop: you don't have to initialise it or decrement it at the end & $n becomes completely unnecessary.
Then at least PHP will be beating the REXX answer.

@user59178 PHP now beats JavaScript. Thanks for the push!

Perl 6, 13 bytes
{[lcm] 1..$_}

Try it
Expanded:
{  # bare block lambda with implicit parameter ｢$_｣

  [lcm]      # reduce using ｢&infix:<lcm>｣

    1 .. $_  # a Range from 1 to the input ( inclusive )
}

Perl, 32 bytes
31 bytes of code + -p flag.
$.++while grep$.%$_,2..$_;$_=$.

Try it online!
The code test every number (starting from 1 and incrementing by 1 each time) to find a common multiple. So it's rather slow even for not so large numbers.
grep$.%$_,2..$_ returns an array of the elements of the range 2..$_ (where $_ is the input) that satisfy $.%$_!=0 ($. is the number we're trying), ie. an array of the elements that aren't a divisor of $.. While this array isn't empty, $.++ is incremented. At the end, $_ is set tp $. and implicitly print thanks to -p flag.

Jelly, 4 bytes
Ræl/

Try it online!
When I posted the question, I thought Jelly didn't have a built-in for this. We were discussing the problem in chat, though, and someone pointed out that it does, so I decided I might as well write the obvious solution using it. (That said, 4 bytes is quite a lot for a challenge that's mostly solved via a built-in! It may well be possible to beat this in some other language, or even in Jelly itself. Update: I see 05AB1E beat this while I was writing out the entry.)
Ideally, this answer shouldn't be voted on either way, in order to let answers which require more skill shine; it's not wrong, but it's also not all that interesting. As the community advert says:
Know how to vote — Byte count isn't everything — Support clever golfing!
Explanation
Ræl/
R    All numbers from 1 to the input
   / Reduce by
 æl  lowest common multiple

I chuckled a bit, because in Norweigan "Ræl" means "junk" or "shit".

@Alec It would be a great reason to upvote this answer if the unpublished intent of the original challenge was to point out that when you accidentally create "real" words when you are coding, it can actually mean other shit.

Sage, 33 28 bytes
No golfing tricks here, but somehow I had an urge to post this xP
l=lambda n:lcm(range(2,n+1))

Too bad Sage's lcm only takes 2 arguments, unlike Octave's variadic one.
It can actually take a list as input.

GAP, 14 bytes
n->Lcm([1..n])

Checking the test cases:
gap> List([1,6,19,22,128], n->Lcm([1..n]) );
[ 1, 60, 232792560, 232792560,
  13353756090997411579403749204440236542538872688049072000 ]

Octave, 25 bytes
@(n)lcm(num2cell(1:n){:})

Maxima, 29 bytes
f(n):=lcm(makelist(x,x,1,n));

Ruby, 22 bytes
->n{(1..n).reduce:lcm}

REXX, 61 bytes
arg a
do m=1 until a<n
  do n=1 to a until m//n>0
  end
end
say m

(Indented for readability)

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


text:
Scroll Word's font size selector
Word's A▲ and ᴀ▼ buttons change the font size according to these rules:

The starting font size is 11.
If ᴀ▼ is pressed when the font size is 1, the size stays 1.
The font size changes with 1 point in the range 1 – 12.
The font size changes with 2 points in the range 12 – 28.
The choices are 28, 36, 48, 72, and 80 in the range 28 – 80.
The font size changes with 10 points in the range 80 – 1630.
The font size changes with 8 points in the range 1630 – 1638.
If A▲ is pressed when the font size is 1638, the size stays 1638.

Task
In as few bytes as possible, determine the resulting font size when given a set of button presses in any reasonable format.
Examples
[3,-1,2], meaning A▲A▲A▲ᴀ▼A▲A▲: The result is 18.
Some possible formats are '^^^v^^', [1 1 1 -1 1 1], [True,True,True,False,True,True], ["+","+","+","-","+","+"], "‘‘‘’‘‘", "⛄⛄⛄⛄⛄", 111011, "CaB", etc...
[2]: 14
[-1]:10
[13]:80
[-11,1]: 2
[11,-1]: 36
[170,-1]: 1630
[2000,-2,100]: 1638

Do we have to take the set of button presses in that exact format? For example, would some or all of these be fine as well: "^vvv^v^^^v", [-1, 1, 1, -1, 1, -1], [0, 1, 0, 1, 1, 0, 1]?

@orlp Yes. Originally I wrote them in, but I found the formats silly. I'll put them in right now.

How about "" or "⛄⛄⛄⛄⛄"

@NickT That's fine.

MATL, 49 47 45 bytes
11: 9:E10+'$*H'o8:163 10*1638v11ihl180h&Ys0))

Input format is [1 1 -1 1 1 -1 -1 -1] or [2 -1 2 -3], with optional commas.
Try it online! Or verify all test cases.
Explanation
11:         % Push [1 2 ... 11]
9:          % Push [1 2 ... 9]
E10+        % Times 2, plus 10: gives [12 14 ... 28]
'$*H'       % Push this string
o           % Convert to double: gives ASCII codes, that is, [36 48 72]
8:163       % Push [8 9 ... 163]
10*         % Times 10: gives [80 90 ... 1630]
1638        % Push 1638
v           % Concatenate everything into a column vector
11          % Push 11
ih          % Input array and concatenate with 11
l180h       % Push [1 180]
&Ys         % Cumulative sum with limits 1 and 180
0)          % Get last value
)           % Index into column vector of font sizes. Implicitly display

Finally a golfing language. I was beginning to wonder...

@Adám We need an answer in APL :)

@APL is not a golfing language. 8×6=48, not 68

@APL is not a mentionable user, neither a user at all.

Word VBA, 199 147 126 116 102 100 87 85  Bytes
Why emulate when you can do?!
Declared function in the ThisDocument module that takes input n in the form of Array(true,true,false,true) and outputs to the Word font size selector :P
Golfed:
Sub a(n):Set f=Content.Font:For Each i In n
If i Then f.Grow Else f.Shrink
Next:End Sub

Ungolfed:
Sub a(n)
    Set f=ThisDocument.Content.Font
    For Each i In n
        If i Then
            f.Grow
        Else
            f.Shrink
        End if
    Next
    ''  Implicitly output font size to MS Word Font Size Selector
End Sub

.GIF of usage

Thanks
-21 thanks to @Adám (removed Selection.WholeStory: call)
-10 thanks to @Adám (assume clean environment; remove f.size=11: call)
-14 thanks to @Adám (cheeky output word font size selector)
-2 thanks to @Adám (bool ParamArray)
-13 for changing ParamArray n() to n and expecting input as Boolean Array
-2 for moving from a code module to the ThisDocument module
Old Version 114 Bytes
Takes input n as a ParamArray, in the form of true,true,false,true and outputs word vbe immediates window
Sub a(ParamArray n()):Set f=Selection.Font:For Each i In n
If i Then f.Grow Else f.Shrink
Next:Debug.?f.Size:End Sub

Older version, 199 Bytes
Takes input in the form of 170,-4,6,-1 (accepts numbers larger than 1 in magnitude)
Sub a(ParamArray n()):Selection.WholeStory:Set f=Selection.Font:f.Size=12:For Each i In n
If i>1 Then
For j=i To 0 Step -1:f.Grow:Next
Else
For j=i To 0:f.Shrink:Next:End If:Next:Debug.?f.Size:End Sub

+1 (I'd give more if I could). Why do you Set f=.Size = 12?

Also, do you need to select the whole story? isn't the current selection enough?

@Adám Thanks :) the f.size=12 should, now that I look at it actually be f.size = 11 and is there so that the sub may be run more than once, as this actually changes the size of the font every time that is is run. Also, you are completely correct in not needing the wholestory call

No need to allow multiple runs. You may assume a clean environment.

Btw, I change the OP title so that there is no implication that actual emulation must be done. Real use is fine too!

A function (not complete program) is allowed per PPCG default rules. Couldn't you Return f.Size instead of printing it?

@Adám in VBA because a function requires Function a...a=n:End Function (26 bytes) calls, it is actually more byte efficient (in most cases) to use a subroutine and print the output Sub a...Debug.?n:End Sub (21 Bytes)

Actually, just use Word's font size selector as output method!

Couldn't n be an array of Booleans, so you can write If i Then?

Does Word VBA support With? That'd probably be slightly shorter than Set for avoiding the need to repeat Selection.Font, if it works.

@ais523 word vba does support with however it requires a end with call that means for code golf it is often, as in this case, more byte-efficient to use a set call

JavaScript (ES6), 103 101 bytes
Takes input as an array of -1 / 1.
a=>a.map(k=>[1,12,28,36,48,72,80,1630,1638].map((v,i)=>n+=n>v&&k*[1,1,6,4,12,-16,2,-2,-8][i]),n=11)|n

Test

let f =

a=>a.map(k=>[1,12,28,36,48,72,80,1630,1638].map((v,i)=>n+=n>v&&k*[1,1,6,4,12,-16,2,-2,-8][i]),n=11)|n

console.log(f([]));
console.log(f([1]));
console.log(f([-1]));
console.log(f([1,1,1,-1,1,1,1,1,1,1,1,1]));
console.log(f(Array(2000).fill(1)));

Saved 2 bytes thanks to ETHproductions

A tip: whenever you have a&&(b=c), you can save a byte with a?b=c:0. Here though, I think you can even save two with n+=n>v&&k*[...][i]

Python 2, 111 107 bytes
i=10;r=range
for d in input():i+=d*(0<i+d<179)
print(r(1,12)+r(12,29,2)+[36,48,72]+r(80,1631,10)+[1638])[i]

Requires input to be in the [-1, 1, 1, -1, ...] format. It works with the examples for some bytes extra:
for d in input():i=min(max(0,i+d),179)

You can save 3 bytes by using  if 0<i<179:i+=d inside the for loop. Costs you a linefeed and a space indent otherwise would be 5.

Or i+=[0,d][0<i<179] might work

@NonlinearFruit Works but comes in at the same byte count for me (108). Looks much cooler and golfier than an if statement tho.

Both suggestions are incorrect. It would mean that if we hit 0 or 179 we're stuck there forever.

@orlp Good point. Missed that one.

Octave, 93 89 87 bytes
The input array can have integers larger than 1 or smaller than -1 to represent multiplicity of action
L=11;for k=input(''),L=min(max(L+k,1),180);end;[1:11 [6:14 18 24 36 40:5:815 819]*2](L)

Thanks to Adám, Changed language to Octave only to be able to use direct indexing into an array.
Saved 2 bytes thanks to rahnema1.
Test
On Ideone

Save 3 bytes by removing the first statement, and changing the last to [1:12,14:2:28,36,48,72,80:10:1630,1638](L).

@Adám Good idea, but then it only works in Octave

@LuisMendo, thanks, fixed it.

@LuisMendo So? Change the language to Octave only.

@Adám Yes, that was my point. I wasn't pointing it out as a drawback

[1:11 [6:14 18 24 36 40:5:815 819]*2] some bytes can be saved!

Ruby, 106 bytes
I managed to shave a couple of bytes off the python solution (and it took a while of shaving).
->n{[*1..12,*(14..28).step(2),36,48,72,*(80..1630).step(10),1638][n.inject(11){|a,b|[0,179,a+b].sort[1]}]}

It's an anonymous function that takes the input in the form of [1, -1, 1, 1, ...]. It seems to deal quite well with input in the form [170,-12] as well, but I can't guarantee it will work 100% of the time, so I'll play it safe and say it works with [1, -1, 1, 1, ...].
Tricks I used:

[0,179,a+b].sort[1]: This clamps a+b to be between 0 and 179, which are the valid indexes of the font-size array.
Using the splat operator on ranges converts them into arrays, so the available font sizes is generated from [*1..12,*(14..28).step(2),36,48,72,*(80..1630).step(10),1638]. Which is a flat array containing the values from each of the flattened elements:

1..12 is a range from 1 to 12 (inclusive). The splat operator turns it into the values 1, 2, 3, ..., 11, 12.
(14..28).step(2) is an enumerator for the given range, where each step goes up by 2. The splat operator turns it into the values 14, 16, 18, ..., 26, 28.
The individual values (36, 48, 72, 1638) are all concatenated in their position into the great font-size array.

I used the inject(/reduce) method, which uses each element of the input array, while reducing them down into a 'memo' variable (as ruby puts it). I initialise this to 11, and the body of each inject iteration is to set this memo variable to the result of adding the current element of the input to the current memo value, and then clamping it between 0 and 180.

All hail the splat operator!

PHP, 116 bytes
first generates the size index (from 1 to 180 inclusive),
then maps that to the point size and prints the result.
for($s=11;$d=$argv[++$i];$s=min($s+$d,180)?:1);echo$s>12?$s>20?$s>23?$s*10-160-2*($s>179):24+(12<<$s-21):$s*2-12:$s;

takes +N and -1 from command line arguments.
(-N is also accepted; just take care that the size does not hop below zero!)
Run with -nr.

Perl 5, 123 106 bytes
@a=(1..12,map$_*2,7..14,18,24,36,map$_*5,8..163,163.8);$i=10;$\=$a[$i=($"=$i+$_)<0?0:$">179?179:$"]for@F}{

Try it online!
Input format:
32 -32 12 4 -2

C (gcc), 157 154 bytes
-3 bytes thanks to ceilingcat.
Takes a string of + (step up) and non-+ (step down). Returns the final font size.
n,d;f(char*s){for(n=11;*s;n=n>28&n<81?index("\34$0HP",n-d)[2*d-1]:n-d+((n>1&n<29)+(n>12&n<29)+(n>80&n<1639)*8+(n>80&n<1631)*2)*(2*d-1))n+=d=*s++==43;s=n;}

Try it online!

@ceilingcat Cheers!

Zsh, 98 bytes
a=({1..12} {14..28..2} 36 48 72 {8..163}0 1638)
r=11
for i;((r+=i,r=(r>$#a)?$#a:(r?r:1)))
<<<$a[r]

Try it online!
Iterate through the arguments, clamping our index between 1 and $#a (length of $a).


text:
2D Maze Minus 1D
This challenge is about converting 2D mazes into 1D mazes.
Overview
+-+-+-+-+-+-+   +-+-+-+-+-+-+                    graph {
| |   |     |   |A|   |    B|   A         B        A -- D
+ + + + +-+-+   + + + + +-+-+    \        |        C -- D
|   | |     |   |   | |     |     \       |        D -- E
+-+-+ +-+-+ +   +-+-+ +-+-+ +      \      |        E -- F
|           |   |C   D E   F|   C---D-E---F        E -- G
+-+-+-+ +-+ +   +-+-+-+ +-+ +         |   |        B -- F
|         | |   |      G  | |     .---G   |        F -- J
+ +-+-+-+ + +   + +-+-+-+ + +   .'   /    |        G -- H
| |       | |   |H|I      |J|   H I-'     J        G -- I
+-+-+-+-+-+-+   +-+-+-+-+-+-+     (ascii)        } // (graphviz dot)
   Figure 1       Figure 2                 Figure 3

For the purposes of this challenge, a traditional 2D maze is a rectangular maze formed from lattice points where all of the following holds:

It is closed (the outer rim is connected by walls).
All lattice points are connected to walls
It is connected (for every two spaces X and Y there is a path between them)
It is acyclic (there are no paths from any space X back to X without backtracking)

Figure 1 shows a traditional 2D maze.  These mazes have three areas of interest:

Dead ends - places from which there is only one available path
Corridors - places from which there are two available paths
Decision points - places from which there are three or four available paths

For every such maze, one can create a graph where the dead ends and decision points are nodes, and there is an edge between every two nodes connected by a path along a corridor.  Figure 2 shows the same maze with such nodes labeled, and Figure 3 the maze's graph (in ASCII and Graphviz dot notation).
1D mazes
1D mazes incorporate warp points, which come in pairs, and are identified using a letter (in either case).  Figure 4 shows an example 1D maze.  This is otherwise identical to a 2D maze with a height of 1, as shown in Figure 5.  Note in particular in Figure 5 the lattice point positions marked by +, which alternate left to right; in the 1D maze, every other character starting with the leftmost wall is also a lattice point.
                                 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  D|  D E|G E F|  F  |  G  |    |  D|  D E|G E F|  F  |  G  |
                                 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+
            Figure 4                         Figure 5

The rules for navigating this maze are as follows.  Every move can be represented as either forward (>) or backward (<).  Forward and backward here by default have the same meaning as our intuitive spatial awareness; forward goes to the position immediately to the right, and backwards immediately to the left.
Warp points represent locations that asymmetrically swap connectedness with neighbors. If you're coming from a neighbor to a warp point, the position of the two warp points is swapped; if you're coming from a warp point to a neighbor, they are not swapped.  For example, in Figure 6, moving backwards from 1 brings you to 2 (since 1 is the neighbor of G, and we're moving from the neighbor, points 2 and @ are swapped).  Moving forward from 2 (warp point G) brings you to 3 (here, we're starting from a warp point, so there's no swap).  Likewise, moving backwards from 3 brings you to @.
        54 2367    89^   @1
|  D|  D E|G E F|  F  |  G  |
                     Y     X
          Figure 6

Figure 6 also shows an example navigation from X to Y, using the sequence of moves <<>><>>>>>.  These moves bring you to the points labeled 123456789^ respectively, in that order.  Feel free to explore it yourself using the code snippet in the next section.
Converting 2D to 1D
Given a 1D maze, one can create a graph where each node is either a dead end or a warp point pair, and edges exist between any two nodes connected along a corridor.  This graph allows us to compare 1D and 2D mazes.
For example, the 1D maze in Figure 4 is the same maze in Figure 1.  To see why,  Figure 7 adds labels to dead ends.  Using those labels to build a graph, Figure 7's graph is simply Figure 3 again.  Figure 8 shows a breakout of building this graph.
|  D|  D E|G E F|  F  |  G  |
 A   C           B   J H   I
          Figure 7

|  D|  D E|G E F|  F  |  G  |
+ + + + + + + + + + + + + + + <- lattice points
|A  |C    |     |B   J|H   I| <- dead ends
|A D|C D E|G E F|B F J|H G I| <- all nodes (dead ends+warp points); i.e.:
                                 "where each end is either a dead end
                                  or a warp point pair"; note that each
                                  pair of warp points is the same node.
|A-D|C-D-E|G-E-F|B-F-J|H-G-I| <- corridors; note each is a connection, since
  1   2 3   4 5   6 7   8 9      "edges exist between any two nodes
                                  connected along a corridor"
   graph {                 graph {
     A -- D  // 1 <---->     A -- D
     C -- D  // 2 <---->     C -- D
     D -- E  // 3 <---->     D -- E
     G -- E  // 4 <---->     E -- G
     E -- F  // 5 <---->     E -- F
     B -- F  // 6 <---->     B -- F
     F -- J  // 7 <---->     F -- J
     H -- G  // 8 <---->     G -- H
     G -- I  // 9 <---->     G -- I
   }                ^      }
    Built from      |      From Figure 3
     1D maze         `-> isomorphic mappings
                Figure 8

(Note that the labels and layout of each graph were artificially chosen to align for illustration purposes;  generally speaking this is a graph isomorphism problem).
The following snippet is provided to help visualize the mechanics of the 1D maze and the connection between the 1D maze, the equivalence graph, and the 2D maze.

var mazeloc = 27; var cheese=21; var pnode=9; var cnode=9;
var spacing = "                            ";
function newCheese() {
   while(cheese==mazeloc){
      var rnum=Math.ceil(Math.random()*23);
      if(rnum>3) ++rnum; if(rnum>9) ++rnum; if(rnum>15)++rnum; if(rnum>21)++rnum;
      cheese=rnum;
   }
   document.getElementById("cheese").innerHTML = spacing.substr(1,cheese)+"#";
}
function getNodeClass(node) {
  switch (node) { case 1: return "ANode"; case 2: return "BNode"; case 3: return "CNode";
      case 4: return "DNode"; case 5: return "ENode"; case 6: return "FNode";
      case 7: return "GNode"; case 8: return "HNode"; case 9: return "INode"; case 10: return "JNode"; } }
function getNodeDefCol(node) {
  switch (node) { case 1: case 2: case 3: case 8: case 9: return "#666"; default: return "#000"; } }
function markMove() {
  var newNode = nodeByLocation(mazeloc);
  if (newNode==0) return;
  var pn = document.getElementsByClassName(getNodeClass(pnode));
  for (var i=0; i<pn.length; ++i) { pn[i].style.color = getNodeDefCol(i); pn[i].style.backgroundColor = "#FFF"; pn[i].style.fontWeight = "400";}
  var cn = document.getElementsByClassName(getNodeClass(cnode));
  for (var i=0; i<cn.length; ++i) { cn[i].style.color = "#800"; cn[i].style.backgroundColor = "#ED9"; cn[i].style.fontWeight="700"; }
  var nn = document.getElementsByClassName(getNodeClass(newNode));
  for (var i=0; i<nn.length; ++i) { nn[i].style.color = "#F00"; nn[i].style.backgroundColor = "#FE8"; nn[i].style.fontWeight="700"; }
  pnode=cnode; cnode=newNode;
}
function nodeByLocation(loc) { switch(loc) { default: return 0;
  case 1: return 1; case 17: return 2; case 5: return 3; case 3: case 7: return 4;
  case 9: case 13: return 5; case 15: case 19: return 6; case 11: case 25: return 7;
  case 23: return 8; case 27: return 9; case 21: return 10; } }
function onClickLeft() {
   switch (mazeloc) {
   case 1: case 5: case 11: case 17: case 23: break;
   case 8: mazeloc=3; break; case 12: mazeloc=25; break;
   case 14: mazeloc=9; break; case 20: mazeloc=15; break;
   case 26: mazeloc=11; break; default: mazeloc=mazeloc-1; break;
   }
   if(mazeloc==cheese) newCheese();
   markMove();
   document.getElementById("inmaze").innerHTML = spacing.substr(1,mazeloc)+"@";
}
function onClickRight() {
   switch (mazeloc) {
   case 3: case 9: case 15: case 21: case 27: break;
   case 2: mazeloc=7; break; case 6: mazeloc=3; break;
   case 8: mazeloc=13; break; case 12: mazeloc=9; break;
   case 14: mazeloc=19; break; case 18: mazeloc=15; break;
   case 24: mazeloc=11; break; default: mazeloc=mazeloc+1;
   }
   if(mazeloc==cheese) newCheese();
   markMove();
   document.getElementById("inmaze").innerHTML = spacing.substr(1,mazeloc)+"@";
}

                     #
|A D|C D E|G E F|B F J|H G I|

                           @

<button type="button" onclick="onClickLeft()"><</button>

<button type="button" onclick="onClickRight()">></button>

  A         B
   \        |
    \       |
     \      |
  C---D-E---F
        |   |
    .---G   |
  .'   /    |
  H I-'     J

  +-+-+-+-+-+-+
  |A|   |    B|
  + + + + +-+-+
  |   | |     |
  +-+-+ +-+-+ +
  |C   D E   F|
  +-+-+-+ +-+ +
  |      G  | |
  + +-+-+-+ + +
  |H|I      |J|
  +-+-+-+-+-+-+

As you navigate the 1D maze in this snippet, the last two nodes you touch are highlighted.  The same nodes are highlighted the same way on the equivalence graph and the 2D maze.

In general, for any traditional 2D maze an equivalent 1D maze of this type can be created.  A slightly more complex example is Figure 9:
+-+-+-+-+-+-+   +-+-+-+-+-+-+                   graph {
| |   |   | |   |A|   |   |B|   A         B       A -- D
+ + + + + + +   + + + + + + +    \       /        C -- D
|   | | |   |   |   | | |   |     \     /         D -- E
+-+-+ + +-+-+   +-+-+ + +-+-+      \   /          B -- E
|           |   |C   D E    |   C---D-E           E -- F
+-+-+-+ +-+ +   +-+-+-+ +-+ +         |\          E -- I
|         | |   |      F  | |     .---F \         F -- G
+ +-+-+-+ + +   + +-+-+-+ + +   .'   /   \        G -- H
| |       | |   |G|H      |I|   G H-'     I       H -- I
+-+-+-+-+-+-+   +-+-+-+-+-+-+     (ascii)       } // (graphviz dot)
   Figure 9       Figure 10             Figure 11

|  D|  D E  |F E  |  F  |       |  D|  D E  |F E  |  F  |
                                 A   C     I     B G   H
      Figure 12                       Figure 13

This maze has a node with four paths (E in Figure 10).  Figure 11 shows its graph.  Figure 12 is an equivalent 1D maze; and Figure 13 shows the same maze with labels for dead ends to compare with Figure 11.
Challenge
Given a 2D Maze as input, write a function or program that transforms the 2D maze into a 1D maze with warp points.  Warp points may use any of the 52 letters in each case.
Input guarantees (if any of these aren't met in the input you don't have to deal with it):

The input maze is connected (that is, you can always go from any spot to any other).
The input maze is closed.
The input maze is rectangular.
All lattice points use +.
All walls between lattice points on the same row use |
All walls between lattice points in the same column use -.
All spaces are part of a path (and all inside the maze).
Paths are all spaces (this will always be traditional, non-warping)
Paths are exactly one space wide.
The maze is built by connecting points on a lattice.
There are no more than 52 total nodes (i.e., dead ends plus decision points) in the maze's graph.

Output format:

Your output should be a single line showing a 1D maze.
Your output should have no leading/trailing whitespace; except that a trailing newline is fine.
The first character and every other character afterwards are lattice points.
All walls should be on lattice points; and all warp points between them.
The graph of your 1D maze should be equivalent to the graph of the 2D maze.
Your 1D mazes must be compact; all non-lattice points must be dead ends (i.e., adjacent to walls) or warp points.
The only letters in your output should be warp points.  Each warp point occurs on the line exactly twice.

Example:
|  D|  D E|G E F|  F  |  G  | <- (1,2) The single line output
+ + + + + + + + + + + + + + + <- lattice point spacing... (3)
                                 (4,6) lattice points are all walls or spaces
                                 (5) See Figure 8
                                 (7) D, E, F, G appear twice; no other labels

This is code-golf.  The winner is the correct non-loophole submission with the least bytes.
Testing
There are no test cases for this challenge, since there are a large number of correct outputs for any nontrivial maze.
I have, however, built a checker in C++ (this checker graphs both solutions through a graph canonicalization).
In addition, here are a few examples to help illustrate proper formatting:
Example 1
+-+-+-+-+-+-+
| |   |     |
+ + + + +-+-+
|   | |     |
+-+-+ +-+-+ +
|           |
+-+-+-+ +-+ +
|         | |
+ +-+-+-+ + +
| |       | |
+-+-+-+-+-+-+
->
|  D|  D E|G E F|  F  |  G  |

Example 2
+-+-+-+-+-+-+
| |   |   | |
+ + + + + + +
|   | | |   |
+-+-+ + +-+-+
|           |
+-+-+-+ +-+ +
|         | |
+ +-+-+-+ + +
| |       | |
+-+-+-+-+-+-+
->
|  D|  D E  |F E  |  F  |

More examples can be found in here.

I don't think the explanation of 1D mazes is very clear at all... Maybe adding a smaller/simpler example would help.

That's pretty cool. Yeah that helps.

Even though your interactive script helped, it's still a difficult problem. So I just skip it. My understanding of this is still tenuous at best.

The description of 1D maze is sketchy. I had to read up to figure 7 to understand that the vertical bar characters in a 1D maze are walls that you cannot pass over.

example 1 with the 1d maze stacked up into a 2d maze where each pair of letters is a ladder: https://gist.github.com/sparr/36d6355cc4c785a27b12157666169082

Python 2 with igraph, 492 369 bytes
import igraph,string
def f(s):
 C=s.find('\n')/2;N=' ';g=igraph.Graph(0,[(i,i+j)for i in range(len(s)/(4*C+4)*C)for j in(1,C)if s[(i/C*2+1)*(2*C+2)+i%C*2+2*j+j/C*3]==N]);V=g.vs;g.d=g.degree;O='';V(_d=1)[N]=N;V(_d_gt=2)[N]=list(string.ascii_letters)
 while g.es:
    v=V(_d=1)[0];O+='|'+v[N]
    while g.d(v):w=v.neighbors()[0];g-=(v,w);v=w;O+=N+v[N]if v[N]else''
 print O+'|'

(The fifth and sixth lines each begin with a tab, not four spaces as StackExchange shows.)

Saved six bytes rearranging some arithmetic
Saved seven bytes using a slice instead of zip
Saved three bytes using g+=tuple(v.neighbors()) instead of g.add_edge(*v.neighbors())
Saved seven bytes using g-=g.es[g.incident(v)] instead of g.delete_edges(g.incident(v))
Saved eleven bytes aliasing g.d=g.degree
Saved 52 bytes (!) eliminating a loop which contracted all the corridors by replacing degree-2 vertices with an edge between their neighbors. Instead, the output loop just ignores these vertices.
Saved 13 bytes noticing that when assigning names, igraph doesn't care if the provided iterable is too long
Saved four bytes by not having a variable R for the number of rows, moving its calculation to the only use point
Saved two bytes changing the second-level indentation to tabs instead of spaces
Saved six bytes rearranging 2*(i%C) to i%C*2, 2*(i/C) to i/C*2, and (C-1)*j to j*C-j
Saved four bytes naming N='n'
Saved one byte determining if a character is space using <'-' rather than ==' ', under the assumption that only valid characters appear.
Then realized I can name the vertex attribute ' ' instead of 'n', and reuse N for the two literal spaces in the source, and ==N instead of <'-', saving five more bytes

A somewhat ungolfed version follows. The basic idea is to first make a graph on all the maze vertices (the spots with odd row and column when zero-indexed.) There is an edge from one vertex to the next one on the same row if the following character is a space, and not |. There is an edge from the vertex to the one right below it if the corresponding character in the following row is a space, and not -.
After building this graph, we pick any leaf, and follow along successively adjacent vertices, writing out their names if they are not a corridor, and deleting used edges, till we get stuck. Then we take another leaf and continue till all the edges are gone.
import string
import igraph
def f(s):
  C = s.find('\n')/2 # number of maze vertices in each row
  R = len(s)/(4*C+4) # number of rows
  def strpos(r, c):
    """Index of the vertex at row r, col c in the newline-delimited string s"""
    return (2*r+1)*(2*C+2) + 2*c + 1
  def vertpos(i):
    """Index of the i-th vertex in s"""
    return strpos(i/C, i%C)
  g = igraph.Graph(edges=[(i, i+(C if j else 1))
                          for i in range(R*C)
                          for j in (0, 1)
                          if s[vertpos(i)+(2*C+2 if j else 1)] == ' '])
  V = g.vs # the graph's vertex sequence
  O = ''
  V(_degree=1)['n'] = ' ' # All leaves are named space
  W = V(_degree_gt=2) # All warp points...
  W['n'] = list(string.ascii_letters[:len(W)]) # ...are named successive letters
  while g.es: # while any edges remain...
    v = V(_degree=1)[0] # find a leaf
    O += '|'+v['n'] # start a new 'block'
    while v.degree():
      w = v.neighbors()[0] # pick a neighbor
      g -= (v, w) # delete that edge
      v = w
      if v['n']: # If it's a dead end or warp point...
        O += ' '+v['n'] # ...write out the new neighbor
  print O+'|'

You can see results for the five example mazes. (Unfortunately, igraph is not available on Try It Online; these results were exported from SageMathCloud.)

Haskell - 481 405 387 bytes
import Data.List
s&t=elemIndices s t
l=last
c!(x:y:z)=l$(y:c)!(x:z):do{[x:p,q]<-mapM([id,reverse]<*>)[[x],[y]];x&[l q];[[]!((q++p):c++z)]}
c![x]=x:[]!c
c!z=z
main=interact(\m->let{g=' '&m;
u=(\\[k|k<-g,length(v>>=(k&))==2])<$>[]!v;
v=[[x,y]|x<-g,y<-g,elem(y-x-1)[0,head$'\n'&m]];
}in '|':(u>>=(++"|").init.(>>=(:" ").toEnum.((+)<*>(+65).(*32).(`div`26)).l.(-1:).(&(nub$u>>=init.tail)))))

This creates a list of spaces that are in the maze, numbered by index in the string, and uses it to find all the pairs of adjacent spaces. It then stitches the pairs together into longer sequences of points based on matching first/last elements and removes the corridors, so that each sequence is one room in the 1D maze. The sequences are then translated into a string by replacing points on the interior of at least one room (the warp points) into corresponding letters and the rest into spaces.
The 2D maze is read from STDIN and the 1D maze is printed to STDOUT.
Edit: Reduced by 62 bytes rearranging a bunch of stuff and modifying the algorithm a bit, and another 14 by replacing chr with toEnum as suggested by Laikoni.
Edit 2: Saved 13 more bytes by simplifying the logic in (!), 3 by using the list pattern match sugar, and 2 by using >>= to concat in u.

I think you don't need the newlines and spaces before the pattern guards, eg o(x:p)q|x==last q=[q++p]|1>0=[] should work too.

Also toEnum should work instead of chr, then import Data.Char could be dropped.

And lastly as the challenge asks for a program or function, you can replace main=interact(\m->...) with just f m=.... This should be enough to beat the python answer, if that means anything to you.


text:
What is the reverse (binary) bit number?
So you are given a POSITIVE base 10 (decimal) number. Your job is to reverse the binary digits and return that base 10 number.
Examples:
1 => 1 (1 => 1)
2 => 1 (10 => 01)
3 => 3 (11 => 11)
4 => 1 (100 => 001)
5 => 5 (101 => 101)
6 => 3 (110 => 011)
7 => 7 (111 => 111)
8 => 1 (1000 => 0001)
9 => 9 (1001 => 1001)
10 => 5 (1010 => 0101)

This is a code-golf challenge, so the solution that uses the least bytes wins.
This is A030101 in the OEIS.

Does "reverse the bits" mean reverse its binary digits? Sometimes it can also mean invert every bit.

Yes. Sorry for being unclear.

This and this are veeeeery similar.

OEIS A030101.

"base 10" Any particular reason why?

Thought I found a really weird property, but 9 broke it. For all examples other than nine, if you reverse the binary number and multiply ones by their index and sum... Then you take that sum and get the "ath prime", it works for all of the numbers that result in primes.

Python, 29 bytes
lambda n:int(bin(n)[:1:-1],2)

Try it online!
This is an anonymous, unnamed function which returns the result.

First, bin(n) converts the argument to a binary string. We would ordinarily reverse this with the slice notation [::-1]. This reads the string with a step of -1, i.e. backwards. However, binary strings in Python are prefixed with an 0b, and therefore we give the slicing's second argument as 1, telling Python to read backwards terminating at index 1, thus not reading indexes 1 and 0.
Now that we have the backwards binary string, we pass it to int(...) with the second argument as 2. This reads the string as a base 2 integer, which is then implicity returned by the lambda expression.

Beat you by 9 seconds.

@mbomb007 I beat you a few seconds too I guess, but I made a small mistake so I deleted mine xP

@mbomb007 http://meta.codegolf.stackexchange.com/a/10812/14215

Oh, haven't seen that. That's a recent meta post. I disagree with it, though.

@mbomb007 so my answer is invalid because you clicked the post button 9 seconds before hand? Just because we reach the same golf at the same time doesn't mean we have to delete any answers. If anything, blame the 0-effort question.

Not invalid, but definitely pointless. If I had been slower, I'd simply delete mine and post a comment on the faster one that I came up with it too.

Slower or not, it's leading in the vote count.

Probably because the sour grapes are amusing. At least for me.

@steenbergh Who cares? Same code, same score.

Python, 29 bytes
lambda n:int(bin(n)[:1:-1],2)

Try it online

This is what I would have done. ;)

JavaScript (ES6), 30 28 bytes
Saved 2 bytes thanks to @Arnauld
f=(n,q)=>n?f(n>>1,q*2|n%2):q

This basically calculates the reverse one bit at a time: We start with q = 0; while n is positive, we multiply q by 2, sever the last bit off of n with n>>1, and add it to q with |n%2. When n reaches 0, the number has been successfully reversed, and we return q.
Thanks to JS's long built-in names, solving this challenge the easy way takes 44 bytes:
n=>+[...n.toString(2),'0b'].reverse().join``

Using recursion and a string, you can get a 32 byte solution that does the same thing:
f=(n,q='0b')=>n?f(n>>1,q+n%2):+q

f=(n,q)=>n?f(n>>1,q*2|n%2):q almost works. But sadly not for n=0.

@Arnauld OP has not yet replied as to whether the input will always be positive, but if so, then 0 doesn't have to be handled.

This is a late follow-up, but the input is now known to be always positive.

Java 8, 53 47 46 45 bytes

-4 bytes thanks to Titus
-1 byte thanks to Kevin Cruijssen

This is a lambda expression which has the same principle as ETH's answer (although recursion would have been too verbose in Java, so we loop instead):
x->{int t=0;for(;x>0;x/=2)t+=t+x%2;return t;}

Try it online!
This can be assigned with IntFunction<Integer> f = ..., and then called with f.apply(num). Expanded, ungolfed and commented, it looks like this:
x -> {
    int t = 0;           // Initialize result holder
    while (x > 0) {      // While there are bits left in input:
        t <<= 1;         //   Add a 0 bit at the end of result
        t += x%2;        //   Set it to the last bit of x
        x >>= 1;         //   Hack off the last bit of x
    }
    return t;            // Return the final result
};

Save 3 bytes with t*2 instead of (t<<1), one more with moving that calculation from loop head to loop body. Can You use x instead of x>0 for the condition?

@Titus not without an explicit cast to a boolean, but thanks for the other tips! Also just realised that x>>=1 can be replaced with x/=2 as it will automatically be integer division.

45 bytes (Changed t=t*2+ to t+=t+.)

@KevinCruijssen nice one!

J, 6 bytes
|.&.#:

|. reverse
&. under
#: base 2

Mathematica, 19 bytes
#~IntegerReverse~2&

Jelly, 3 bytes
BUḄ

Try it online!
B   # convert to binary
 U  # reverse
  Ḅ # convert to decimal

That's pretty short, BUB

Hmm... Is that really 3 bytes?

@aioobe Yep. Jelly uses it's own code page where each of these characters is 1 byte.

Cool, thanks!

C, 48 44 43 42 bytes
-1 byte thanks to gurka and -1 byte thanks to anatolyg:
r;f(n){for(r=n&1;n/=2;r+=r+n%2);return r;}

Previous 44 bytes solution:
r;f(n){r=n&1;while(n/=2)r=2*r+n%2;return r;}

Previous 48 bytes solution:
r;f(n){r=0;while(n)r=2*(r+n%2),n/=2;return r/2;}

Ungolfed and usage:
r;
f(n){
 for(
  r=n&1;
  n/=2;
  r+=r+n%2
 );
 return r;}
}

main() {
#define P(x) printf("%d %d\n",x,f(x))
P(1);
P(2);
P(3);
P(4);
P(5);
P(6);
P(7);
P(8);
P(9);
P(10);
}

Isn't r already initialized to zero here r;f(n){r=0;, e.g. the r=0; is unnecessary? Also minor typo: "Previous 48 bytes solution"

@gurka The function should be reusable.

I think that for loops are always at least as short as while loops, and often shorter.

@anatolyg something like: r;f(n){for(r=n&1;n/=2;r=2*r+n%2);return r;}? 1 byte shorter, but I'm unsure if it's valid C (C99).

Yes; also, turn = into += to make it shorter and more obfuscated

Labyrinth, 23 bytes
?_";:_2
  :   %
 @/2_"!

Well, this is awkward... this returns the reverse BINARY number...
Thanks @Martin Ender for pointing out both my bug and my ID 10T error.
So this doesn't work, I'll have to find another solution.

Welcome to PPCG, and nice first post! Just completing a challenge in a language like Labyrinth can be very difficult. Around here, we usually prefix the first line of an answer with one or two hashes, to make it show as a header: # Labyrinth, 89 bytes

Did you accidentally omit a leading space from the second row? As it stands, the program would just bounce back and forth on the first line because the _ are on the junctions.

Unfortunately, I just noticed that this isn't valid regardless, because the challenge asks for the base-10 representation of the reversed number, not its binary representation.

Ruby, 29 28 bytes
->n{("%b"%n).reverse.to_i 2}

"%b" % n formats the input n as a binary string, reverse, then convert back to a number
Usage/Test cases:
m=->n{("%b"%n).reverse.to_i 2}
m[1] #=> 1
m[2] #=> 1
m[3] #=> 3
m[4] #=> 1
m[5] #=> 5
m[6] #=> 3
m[7] #=> 7
m[8] #=> 1
m[9] #=> 9
m[10] #=> 5

@Titus I think you misunderstand the answer. 2 is the base he is converting to, and n is the input. ->args{return value} is the ruby lambda syntax

Can you remove the parentheses in .to_i(2)?

@Cyoce sure enough, thanks.

05AB1E, 3 bytes
bRC

Try it online!

Java (OpenJDK), 63 bytes
a->a.valueOf(new StringBuffer(a.toString(a,2)).reverse()+"",2);

Try it online!
Thanks to poke for -12 bytes and to Cyoce for -8 bytes!

Even though REPL submissions are allowed, they still follow the rule that you can't assume input is in predefined variables (like a in this context)

@FlipTack Oops. It was originally a function before I remembered the repl existed

Well I suppose you can just do a-> at the start to make it a lambda expression and cut out the println. That might make it shorter.

Also, in the future, use print instead of println for golfing :)

As far as I can tell, this prints the reverse binary string, rather than evaluating it as a new integer.

@FlipTack I think it works now. Only gained a byte.

Long.toString(a,2) saves 4 bytes over Long.toBinaryString(a)

StringBuffer saves a byte over StringBuilder

@Poke Thanks, I appreciate it!

a is of type Long so you should be able to use a.parseLong and a.toString. It will give a warning about using a static method in a non-static way or something but that's fine. Saves 6 bytes.

a.valueOf instead of a.parseLong should save a byte

Could you do +"" instead of .toString()?

@Cyoce Was about to comment this, but then I saw yours at the bottom. +1 from me, that should definitely be possible for the empty .toString().

Haskell, 36 bytes
0!b=b
a!b=div a 2!(b+b+mod a 2)
(!0)

Same algorithm (and length!) as ETHproductions’ JavaScript answer.

PHP, 33 bytes
<?=bindec(strrev(decbin($argn)));

convert to base2, reverse string, convert to decimal. Save to file and run as pipe with -F.
no builtins:
iterative, 41 bytes
for(;$n=&$argn;$n>>=1)$r+=$r+$n%2;echo$r;

While input has set bits, pop a bit from input and push it to output. Run as pipe with -nR.
recursive, 52 bytes
function r($n,$r=0){return$n?r($n>>1,$r*2+$n%2):$r;}

@JörgHülsermann The 44 bytes have $r+=$r. But I actually don´t remember why I put that in front.

Japt, 5 3 bytes
-2 bytes thanks to Shaggy
¢ÔÍ

Try it online!

Nice, exactly what I had. The ) could be a space too :-)

This can now be ¢ÔÍ or ¤ÔÍ.

Perl 6, 19 bytes
{:2(.base(2).flip)}

Where is the input?

This is a function that takes a single parameter $_.  It isn't mentioned by name, but the base method is called on it.

@Titus in Perl 6 a Block is a type of Code, which is to say it's a callable object. The above is an expression that you can take and assign to a variable like a function or lambda in another language, or call directly — {:2(.base(2).flip)}(10) at the REPL will print 5. So it meets the standard code-golf criteria for a function.

Bash/Unix utilities, 24 23 bytes
dc -e2i`dc -e2o?p|rev`p

Try it online!

A courageous take on Bash!

@juniorRubyist -- Thank you!

Scala, 40 bytes
i=>BigInt(BigInt(i)toString 2 reverse,2)

Usage:
val f:(Int=>Any)=i=>BigInt(BigInt(i)toString 2 reverse,2)
f(10) //returns 5

Explanation:
i =>          // create an anonymous function with a parameter i
  BigInt(       //return a BigInt contructed from
    BigInt(i)     //i converted to a BigInt
    toString 2    //converted to a binary string
    reverse       //revered
    ,
    2             //interpreted as a binary string
  )

MATL, 4 bytes
BPXB

Try it online!
Explanation
B     % Input a number implicitly. Convert to binary array
P     % Reverse array
XB    % Convert from binary array to number. Display implicitly

Pyth, 6 bytes
i_.BQ2

Test suite available here.
Explanation
i_.BQ2
    Q     eval(input())
  .B      convert to binary
 _        reverse
i    2    convert from base 2 to base 10

APL (Dyalog Unicode), 10 bytes
2⊥∘⊖2∘⊥⍣¯1

Try it!
Thanks to @Adám for 2 bytes.
How it works:
This is a tacit function. To use it, it has to be assigned a name (like f←) and then called over an input; for the test cases: f 1, f 2, etc.
2⊥∘⊖2∘⊥⍣¯1  # Main function; tacit.
       ⍣¯1  # invert
    2∘⊥     # convert from base 2 (which is inverted to 'convert to base 2')
  ∘⊖        # flip, then
2⊥          # convert from base 2

Batch, 62 bytes
@set/an=%1/2,r=%2+%1%%2
@if %n% gtr 0 %0 %n% %r%*2
@echo %r%

Explanation: On the first pass, %1 contains the input parameter while %2 is empty. We therefore evaluate n as half of %1 and r as +%1 modulo 2 (the % operator has to be doubled to quote it). If n is not zero, we then call ourselves tail recursively passing in n and an expression that gets evaluated on the next pass effectively doubling r each time.

C#, 98 bytes
using System.Linq;using b=System.Convert;a=>b.ToInt64(string.Concat(b.ToString(a,2).Reverse()),2);

R, 55 bytes
sum(2^((length(y<-rev(miscFuncs::bin(scan()))):1)-1)*y)

Reads input from stdin and consequently uses the bin function from the miscFuncs package to convert from decimal to a binary vector.

Mathematica, 38 bytes
#+##&~Fold~Reverse[#~IntegerDigits~2]&

Groovy, 46 bytes
{0.parseInt(0.toBinaryString(it).reverse(),2)}

Does this take any input?

@Titus it refers to the argument given to a block IIRC

I love how this is the same length as my Java answer - Java and groovy, unite!

@FlipTack I'm gonna go cry now.

CJam, 8 bytes
ri2bW%2b

Try it online!
Explanation
ri          e# Read integer
  2b        e# Convert to binary array
    W%      e# Reverse array
      2b    e# Convert from binary array to number. Implicitly display

Pushy, 19 bytes
No builtin base conversion!
$&2%v2/;FL:vK2*;OS#

Try it online!
Pushy has two stacks, and this answer makes use of this extensively.
There are two parts two this program. First, $&2%v2/;F, converts the number to its reverse binary representation:
            \ Implicit: Input is an integer on main stack.
$      ;    \ While i != 0:
 &2%v       \   Put i % 2 on auxiliary stack
     2/     \   i = i // 2 (integer division)
        F   \ Swap stacks (so result is on main stack)

Given the example 10, the stacks would appear as following on each iteration:
1: [10]
2: []

1: [5]
2: [0]

1: [2]
2: [0, 1]

1: [1]
2: [0, 1, 0]

1: [0]
2: [0, 1, 0, 1]

We can see that after the final iteration, 0, 1, 0, 1 has been created on the second stack - the reverse binary digits of 10, 0b1010.
The second part of the code, L:vK2*;OS#, is taken from my previous answer which converts binary to decimal. Using the method decsribed and explained in that answer, it converts the binary digits on the stack into a base 10 integer, and prints the result.

Labyrinth, 22 bytes
_2/?+:{!
}    "
++:{%#

Try it online!
Explanation
The idea is to disassemble the input bit-by-bit while assembling the output from the other end. Luckily, it's easiest to deconstruct a number from the right, and build one up from the left, so this automatically reverses the bits. We'll generally be keeping what's left of the input on top the main stack, and what we've already computed of the result on top of the auxiliary stack.
_2/  When the program starts out, this doesn't really do anything, because it
     just divides an implicit zero by 2.
?+   Read an integer N from STDIN and add it to the implicit zero on top of
     the stack.

     The main loop starts here:

:    Duplicate what's left of N. This is also used as the conditional to end
     the loop. Once this reaches zero, the IP moves straight ahead, exiting
     the loop. Otherwise, the IP turns south which continues the loop.
#    Push the stack depth, 2.
%    Take N modulo 2, i.e. get its least significant bit.
{    Fetch the intermediate result R from the auxiliary stack.
:+   Double it (shifting its existing bits left by one position).
+    Add the bit we just extracted from N to R.
}    Put R back on the auxiliary stack.
_2/  Divide N by 2, dropping its least significant bit.
?+   We're at EOF, so ? just pushes zero and the + gets rid of that zero.

     Then the main loop starts over.
     When we exit the loop (once N is zero), this bit is run:

{    Retrieve R from the auxiliary stack.
!    Print it.
     The IP hits a dead end and turns around.
{:+? Various shenanigans which simply leave a zero on top of the stack.
/    Terminates the program due to the attempted division by zero.

Vyxal, 3 bytes
bṘB

Try it Online!
Converts to a binary string, reverses it, then puts it back in base 10.

So then when will you be back?

Btw the link doesn't have any input in it.

Perl 5 (5.12+), 32 bytes
say oct reverse sprintf"%bb0",<>

(Input on stdin, output on stdout, requires -E or -M5.012 at no cost).
Straightforward but not all that short. Too bad "reverse" and "sprintf" are such weighty keywords.
oct is an odd legacy name; oct "123" gives the decimal equivalent of octal 123 as you'd expect, but oct "0x123" interprets its input as hex and oct "0b101" interprets it as binary.

You can shave a couple of characters off this by including the 0b in the sprintf statement:
say oct reverse sprintf"%bb0",<>

Java 7, 94 89 bytes
Golfed:
int x(int n){return Long.parseLong(new StringBuffer(Long.toString(n,2)).reverse()+"",2)};

Ungolfed:
int x(int n)
{
    return Integer.parseInt(new StringBuffer(Integer.toString(n, 2)).reverse() + "", 2);
}

5 bytes saved thanks to @corvus_192

You can use Long.parseLong and Long.toString to save a few bytes.

C#, 167 bytes
 for(int i = 1; i <= 10; i++)
 {
 var bytes= Convert.ToString(i, 2);
 var value= Convert.ToInt32(byteValue.Reverse());
 console.WriteLine(value);
}

Explanation:
Here I will iterate n values and each time iterated integer value is convert to byte value then reverse that byte value and that byte value is converted to integer value.

Welcome to the site!  I don't know much about C# but you most certainly have a good deal of extra whitespace I would recommend removing.  It also is not clear how I/O is dealt with in this submission.  It is standard to either write a function or to use STDIN (I think that is console.Read() but you would probably know better than I would) and STDOUT.   Anyway, welcome to the site if you want more experienced advice in golfing C# I would recommend http://codegolf.stackexchange.com/questions/173/tips-for-code-golfing-in-c

I've downvoted this answer, because it doesn't work at all. .Reverse() returnes IEnumerable<char>. As Convert.ToInt32 doesn't have an overload for IEnumerable it throws an exception. Also the answer doesn't follow the rules for code golf: 1)As nothing is specified the submission has to be a full program or function not just a snippet. 2)using statements must be included in the byte count

k, 18 bytes
{2/:|X@&|\X:0b\:x}

Example:
k){2/:|X@&|\X:0b\:x}6
3

c/c++ 136 bytes
uint8_t f(uint8_t n){int s=8*sizeof(n)-ceil(log2(n));n=(n&240)>>4|(n&15)<<4;n=(n&204)>>2|(n&51)<<2;n=(n&172)>>1|(n&85)<<1;return(n>>s);}

It's not going to win, but I wanted to take a different approach in c/c++
120 bytes in the function
#include <math.h>
#include <stdio.h>
#include <stdint.h>

uint8_t f(uint8_t n){
    int s=8*sizeof(n)-ceil(log2(n));
    n=(n&240)>>4|(n&15)<<4;
    n=(n&204)>>2|(n&51)<<2;
    n=(n&172)>>1|(n&85)<<1;
    return (n>>s);
}

int main(){
    printf("%u\n",f(6));
    return 0;
}

To elaborate on what I am doing, I used the log function to determine the number of bits utilized by the input.  Than a series of three bit shifts left/right, inside/outside, even/odd which flips the entire integer. Finally a bit shift to shift the number back to the right. Using decimals for bit shifts instead of hex is a pain but it saved a few bytes.

You do need to include the function declaration, so this is actually 163 bytes. Although, if you remove the extraneous whitespace, you could shorten it to 136.

124 bytes

Pari/GP , 28 byte
The value to be "reversed" is expected in variable a; i.e. do a=37 first.
Then execute the cmd. Because Pari/GP is interpreting you do not need to add an extra print(b) because referencing a variable or a result just prints it to the console:
  b=a%2;while(a\=2,b+=b+a%2);b

Example:
  a=37
  b=a%2;while(a\=2,b+=b+a%2);b
  \\ printed result is: 41

Try it online!

SmileBASIC, 41 bytes
INPUT N
WHILE N:T=T+T+N MOD 2N=N>>1WEND?T

Basically a port of the C/Java versions.

8th, 41 29 bytes
2 base drop >s rev >n decimal

Usage
ok> 37 2 base drop >s rev >n decimal .
41

Test case
: f 2 base drop >s s:rev >n decimal ;
( dup . " => " . f . cr ) 1 10 loop

1 => 1
2 => 1
3 => 3
4 => 1
5 => 5
6 => 3
7 => 7
8 => 1
9 => 9
10 => 5

Julia, 32 bytes
f(n)=parseint(reverse(bin(n)),2)

gives a warning but still runs

Is this a full program or a function, because it looks like a snippet? If this is a snippet, you can change it so that it conforms with our rules.

if you run this exact code on the interpreter it returns the value. If it must return using the return keyword, I will add that in. other than that, and input, this is a full program. just substitute n for any number (input was not specified in the rules, unless thats a default requirement)

Husk, 3 bytes
ḋ↔ḋ

Try it online!
Explanation
Here's an explanation, even if there's not much to it:
     -- implicit input N    | 10
  ḋ  -- convert to base2    | [1,0,1,0]
 ↔   -- reverse             | [0,1,0,1]
ḋ    -- convert from base2  | 5

JavaScript, 44 bytes

f=i=>(a=0,(x=i=>i?(a=a*2+i%2,x(i>>1)):a)(i))

for(i=1;i<10;i++){console.log(i,f(i))}

Add++, 14 bytes
D,f,@,BBBR2@Bb

Try it online!
How it works
D,f,@,   - Create a monadic function named f. Example argument: [10]
      BB - Convert to binary;     STACK = ['1010']
      BR - Reverse the top value; STACK = ['0101']
      2  - Push 2;                STACK = ['0101' 2]
      @  - Reverse the stack;     STACK = [2 '0101']
      Bb - Convert from base;     STACK = [5]
         - Implicit return

RProgN 2, 6 bytes
2Bi2iB

Try it online!

REXX, 46 bytes
say x2d(b2x(reverse(trunc(x2b(d2x(arg(1)))))))

Scala 47 bytes
Handles BigInt
((i:BigInt)=>BigInt(i.toString(2).reverse,2))([Number to Reverse])

if only we could:
(i=>BigInt(i.toString(2).reverse,2))([Number to Reverse])

or
(BigInt(_.toString(2).reverse,2))([Number to Reverse])

Example (REPL):
scala> ((i:Int)=>BigInt(i.toString(2).reverse,2))(100)
res1: scala.math.BigInt = 19

Example (in Situ):
object main extends App {
    val arg = Option(args).getOrElse(Array[String]("100"))
    (BigInt(arg(0)) to BigInt(arg(1))).map((n)=>
    (println(n + "-->" + BigInt(n.toString(2).reverse, 2))))
}

run:
run 20 30

result:
[debug] Waiting for thread run-main-23 to terminate.
20-->5
21-->21
22-->13
23-->29
24-->3
25-->19
26-->11
27-->27
28-->7
29-->23
30-->15
[debug]         Thread run-main-23 exited.

C 41 bytes
g(i,r){for(r=0;r+=r+i%2,i/=2;);return r;}

Input in "i" output the result
Try it online!

Common Lisp, 52 bytes
(parse-integer(reverse(format()"~b"(read))):radix 2)

Try it online!

Go, 49 bytes
A function literal based off my Java answer:
func(x int)(t int){for;x>0;x/=2{t+=t+x%2};return}

Try it online!

Thunno 2, 3 bytes
ḃrḂ

Try it online!
Explanation
ḃrḂ  # Implicit input
ḃ    # To binary
 r   # Reverse
  Ḃ  # From binary
     # Implicit output


text:
Find all the coordinates on a path
Given a 2D string as input, either as a string with newlines or a list of lines, output the coordinates (x, y) of all the hashes (#) in the list.  The input will only contain hashes and spaces. (and newlines, if you choose to take input as a 2D string)
If there are no hashes, you can output anything.
Output should be unambiguous as to which numbers are paired with which.
Example:
##

Should output:
(0,0), (1,0)

That assumes 0-based indexing, starting from the top left. You may start from any corner, use 0 or 1-based indexing, and/or output y first. (e.g. in the form y,x).
More test cases (again, all using 0-based top-left (x, y) indexing):
    #
#####
#

(4, 0), (0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (0, 2)

# ###
### #

(0, 0), (2, 0), (3, 0), (4, 0), (0, 1), (1, 1), (2, 1), (4, 1)

Note that these test cases all list by rows, not by following the path.
You may assume the hashes will form a continuous trail, i.e. # # will never be the input. (probably won't matter, but in case somebody wants to regex this)
You also can output the coordinates in any order you want, i.e. vertical columns, horizontal rows, or just an unsorted list.

Can we assume the input only contains hashes and spaces?

@DJMcMayhem yes, editing that into the question.

Would this or this be valid output formats?

@Zgarb basically with the extra 1,1 and the hash? Eh, sure.

Would my alternate format be valid?

@FlipTack define flat list? i.e. [1, 2, 3, 4] where [1,2] and [3,4] are the coordinates? No.

What about [[(0, 0)], [(1, 0), (1, 1), (1, 2), (1, 3)], [(2, 3)]] - a list for each row, containing its coordinates?

@FlipTack that works, yes.

@EasterlyIrk Would this.. "format" qualify as input?

@devRicher that test case won't happen at all, but I may allow that input format. I'll ping you in chat.

Slip, 2 + 1 = 3 bytes
+1 byte for the p flag. Code:
`#

Explanation:
The p-flag returns the position of each occurence of the following:
`#      // The character '#'

Try it here!

I think we have a winner

Any explanation?

@EasterlyIrk The backtick escapes a single character as string. The flag requests positional results.

@Adám oh, cool!

Grime, 5 bytes
pa`\#

Try it online!
The output format is a bit funky, but OP has stated that it's valid.
Explanation
Grime is my 2D pattern matching language.
The part after ` is the pattern, in this case a 1×1 square containing a #-character.
Grime will search the input grid for a match, and prints the first one it finds by default.
The part before ` contains options, in this case signifying that all matches (a) should be printed, along with their positions and sizes (p).

Python, 67 bytes
This is actually just a golf of my Stack Overflow answer on a similar topic.
lambda a,e=enumerate:[[(i,j)for j,B in e(A)if'!'<B]for i,A in e(a)]

Try it online!
The loops through the 2D list, recording the hash characters, and returns the result. We save a byte by using char > '!' rather than char == '#', because the input will only consist of hashes and spaces, and so hashes (0x23) will be the only characters larger than exclamation marks (0x21).

MATL, 7 6 5 bytes
This is using 1-based indexing with (1,1) in the top left corner.
oo&fh

Explanation:
o        % convert char to double
 o       % remainder mod 2 ('#' == 35, ' '==32) makes spaces falsy
  &f     % apply `find` with 2d-output
    h   % concatenate outputs to display x- and y-coordinates side by side

Thanks @DJMcMayhem and @LuisMendo for each -1 byte!
Try it online!

You could do ooH#fh to save one byte. (convert to integers, mod2) Since space is even (mod 2 == 0, falsy) and # is odd (mod 1 == 1, truthy)

Oh, great, thank you very much!=)

JavaScript (ES6), 70 67 bytes
s=>s.replace(/./g,(c,i)=>c>' '?[i%l,i/-l|0]+' ':'',l=~s.indexOf`
`)

Outputs a newline-and-space-separated list of coordinates, e.g.
4,0
0,1 1,1 2,1 3,1 4,1
0,2

You can get much shorter with a weird output format:
s=>s.replace(/#/g,(c,i)=>[i%l,i/-l|0]+c,l=~s.indexOf`
`)

This outputs
    4,0#
0,1#1,1#2,1#3,1#4,1#
0,2#

for the second test case. It's still clear which numbers are paired with which...

J, 12 bytes
$#:'#'I.@:=,

Try it online!
Explanation
$#:'#'I.@:=,  Input is y.
           ,  Flatten y
   '#'    =   and form bit vector of equality with #.
      I.@:    Compute positions of 1s
 #:           and convert each to base
$             shape of y.

Dyalog APL 16.0, 5 chars = 9 bytes or 6 chars = 8 bytes
Gives list of (y,x) pairs from top left.
⍸⎕='#'

⍸ where
⎕ input
= equals
'#' this character*
* It is possible to save a character at the cost of one byte by replacing '#' with ⍕# (format the root namespace)
TryAPL online! Note that ⍸ has been emulated with i  because TryAPL runs version 14.0.

Pretty sure in Dyalog APL encoding 1 char = 1 byte, no?

@devRicher Normally, but ⍸ is not included in the single byte version. See the "bytes" link.

Jelly, 8 bytes
n⁶T€,€"J

Try it online!
Given a 2D array of characters (= a list of strings):
            Implicit input (example):
               [[' ', ' ', ' ', ' ', '#']
               ,['#', '#', '#', '#', '#']
               ,['#', ' ', ' ', ' ', ' ']]
n⁶          Not-equal to space (⁶).
               [[0, 0, 0, 0, 1]
               ,[1, 1, 1, 1, 1]
               ,[1, 0, 0, 0, 0]]
  T€        Indices of 1s in each row
               [[5], [1,2,3,4,5], [1]]
    ,€"J    Pair each, vectorizing, with y-indices
               [[[5,1]], [[1,2],[2,2],[3,2],[4,2],[5,2]], [[1,3]]]

JavaScript (Firefox 30-57), 61 bytes
s=>[for(c of(x=0,y=1,s))if(c<' '?(y++,x=0):(x++,c>' '))[y,x]]

Returns 1-based coordinates. Easily switchable between [y, x] and [x, y] ordering. Ungolfed:
function coords(s) {
    var x = 0;
    var y = 1;
    for (Var c of s) {
        if (c == "\n") {
            y++;
            x=0;
        } else {
            x++;
        }
        if (c == "#") {
            console.log(y, x);
        }
    }
}

Vim, 37 bytes
:%s/#/\=line('.').','.col('.').' '/g<cr>

Since V is mostly backwards compatible, you can Try it online!
A straightforward regex solution, where it replaces each '#' with the location it was found in (one-based indexing). I was a little bit worried while writing this that the location would change after substituting the first one on a line, but that doesn't seem to be an issue. TBH I'm pleasantly shocked by how simple this solution ended up being.
Unfortunately, vimscript is very verbose, so most of the bytes come from separating the results so that is still legible. Otherwise, we could do
:%s/#/\=line('.').col('.')/g

But this creates output that's pretty hard to interpret. Additionally, it will only work it the grid is always 9x9 or smaller.
This is a really fun solution because it shows each pair of coordinates at the location of the hash it represents. For example, the input
# ###
### #

outputs
1,1  1,3 1,4 1,5
2,1 2,2 2,3  2,5

Of course, if we were using V, we could remove the trailing newline, and compress the regex. Then it could simply be
Í#/½line('.').','.col('.').' '/g

(32 bytes)
But since this is the exact same approach and still painfully verbose, it doesn't seem worth it to use a golfing language.

Okay, the whole "shows each pair of coordinates at the location of the hash" is pretty darn cool. +1

Haskell, 53 bytes
concat.zipWith(\y l->[(x,y)|(x,'#')<-zip[0..]l])[0..]

Input is taken as a list of strings. The output is a list of (x,y) pairs (0 indexed), e.g.
*Main> concat.zipWith(\y l->[(x,y)|(x,'#')<-zip[0..]l])[0..] $ ["# ###","### #"]
[(0,0),(2,0),(3,0),(4,0),(0,1),(1,1),(2,1),(4,1)]

Lua, 141 bytes
w=io.read()x=w:sub(1,w:find("\n")-1):len()_,c=w:gsub("\n","")for i=0,x do for j=0,c+1 do if w:sub(c*x+i,c*x+i)=="#"then print(i,j)end end end

It's 2:30 AM, I'm in bed, on my phone. Why am I doing this?

APL (Dyalog Extended), 2 bytes
⍸<

Try it online!
I win. (Though it's technically tie because we don't count flags in bytes anymore...)
Basically works like the existing APL answer, but it doesn't test for equality with '#'; it tests if each char is non-blank.

Groovy, 80 68 bytes
{y=0;it.each{it.eachWithIndex{x,i->print(x=='#'?"($i,$y)":"")};y++}}

Example input:
[#   #,#   #,#####]

Example Output:
(0,0)(4,0)(0,1)(4,1)(0,2)(1,2)(2,2)(3,2)(4,2)

Why split the input into lines, when the task description allows taking an already split list of lines?

Mathematica, 12 bytes
Position@"#"

Operator form of Position. Assumes a 2D array of characters. 1-indexed starting at the top left entry. Outputs a list of coordinates in the form {row,column}.

The way I read the task description, I don't think taking a 2D array of characters is allowed for languages that support strings.

@smls http://meta.codegolf.stackexchange.com/a/2216/61980

I'm not convinced. For one thing, that question focuses on char[], which is actually a common way to store strings in C-based languages. Also, this task description specifically mentions "either as a string with newlines or a list of lines", and doesn't mention list-of-lists-of-characters or 2D matrix of characters.

@smls Exactly. The consensus was that if a question specifies a string, it means a sequence of characters, and if your language has more than one way of expressing that, then you are free to choose the one that suits your golfing needs. Specifying "either as a string with newlines or a list of lines" does nothing to change that since if you represent each line as an array of characters then you get exactly a 2D array of characters.

PHP, 69 bytes
for(;$a=$argv[++$i];)for($j=0;""<$c=$a[$j++];)echo$c>" "?"$j $i,":"";

Uses 1-based indexing starting from the top left.
Use like:
php -r 'for(;$a=$argv[++$i];)for($j=0;""<$c=$a[$j++];)if($c>" ")echo"$j $i,";' '    #' '#####' '#    '

Will output:
5 1,1 2,2 2,3 2,4 2,5 2,1 3,

RBX.Lua, 131 bytes
Has to assume input is valid (Z is the flat axis, whitespaces are White tiles, hashes can be any other color, top-left part is located at 0, 0, 0) and all parts are part of the same model M, and the model is otherwise empty.
for k,v in pairs(workspace.M:GetChildren())do if v.BrickColor~=BrickColor.new("White")then print(v.Position.X,-v.Position.Y)end end

Sample input/output:

Can you provide a valid i/o example?

@EasterlyIrk There, edited the answer.

C, 113 bytes
i,j,k,l;f(char**p){i=strlen(*p);l=strlen(p);for(j=0;j<l;j++)for(k=0;k<i;k++)if(p[j][k]==35)printf("%d,%d ",k,j);}

Outputs from test cases:
0,0 2,0 3,0 4,0 0,1 1,1 2,1 4,1
4,0 0,1 1,1 2,1 3,1 4,1 0,2

Try it online!

Perl 6, 25 bytes (22 characters)
{^∞ZX@_».indices("#")}

Takes input as a list of lines.
Outputs one list per line, each containing (y, x) tuples for the coordinates.
Try it online!
How it works
{                    }  # A lambda.
{    @_»             }  # For each input line:
        .indices("#")   #    get x-coordinates.  (4) (0 1 2 3 4) (0)
 ^∞                     # Range from 0 to Inf.    0   1           2 ...
   Z                    # Zip with:              (0 (4)) (1 (0 1 2 3 4)) (2 (0))
    X                   #    Cartesian product.  ((0 4)) ((1 0) (1 1) (1 2) (1 3) (1 4)) ((2 0))

Ruby, 24 + 1 = 25 bytes
+1 byte for -n flag. Coordinates are 1-based, one number per line.
gsub(/#/){p$`.size+1,$.}

Try it online!

Uiua SBCS, 4 bytes
⊚=@#

Try it!
⊚=@#
 =@#  # mask of hash characters
⊚     # coordinates

C, 80 bytes
x,y;f(char*s){for(x=y=0;*s;printf(*s-35?"":"%d,%d ",x,y),*s++==10?++y,x=0:++x);}

Requires input as newline-delimited char array, prints output to screen.
Ungolfed & usage:
x,y;

f(char*s){
 for(
  x = y = 0;             //init coordinates
  *s;                //iterate until end
  printf(*s-35 ? "" : "%d,%d ", x, y),     //print coordinates or empty string
  *s++==10 ? ++y, x=0 : ++x              //advance to the right or the next line
 );
}

main(){
 f("    #\n#####\n#    ");
 puts("");
 f("# ###\n### #");
}

78 bytes: x,y;f(char*s){for(x=y=0;*s;*s++==10?++y,x=0:++x)*s==35&&printf("%d,%d ",x,y);}