Skip to main content
Commonmark migration
Source Link

#Br**nfuck, 128-5=123 bytes

Br**nfuck, 128-5=123 bytes

#Br**nfuck, 128-5=123 bytes

Br**nfuck, 128-5=123 bytes

Updated tests. Formatted explanation.
Source Link
Cell 3 (0-indexed) is the running total x. This calculates the nth tetration of a.  +<<+<<,<, Initialize tape with [n, a, 0, 1, 0, 1] [ While n:  >[>+>>+<<<-]>[<+>-]  Copy a 3 cells to right: [n, a, 0, x, a, 1] >[ >[ While x:  >[>>+>+<<<-]>>>[<<<+>>>-]  Copy a 2 cells to right: [n, a, 0, x, a, 1, a, 0]  <<[>[>+>+<<-]>>[<<+>>-]<<<-]  Cell 7 = prod(cell 5, cell 6)  >[-]>[<<+>>-]<<<<-]  Move this value to cell 5. End while.  >>[<<+>>-]+<[-]<<<<-]  Update x to result of exponentiation. End while. >>>. Print the result! 

This works (tested) for x 0, 0 x, x 1, 1 x, x 2, 2 3, and 2 4. I tried 3 3, but it ran for several hours without finishing (in my Java implementation—probably not optimal) (EDIT: in @Timwi's EsotericIDE [It's great! Y'all should try it] as well. No luck.). In theory, this works up to the cell size of the specific implementation.

Cell 3 (0-indexed) is the running total x. +<<+<<,<, Initialize tape with [n, a, 0, 1, 0, 1] [ While n: >[>+>>+<<<-]>[<+>-]  Copy a 3 cells to right: [n, a, 0, x, a, 1] >[ While x: >[>>+>+<<<-]>>>[<<<+>>>-]  Copy a 2 cells to right: [n, a, 0, x, a, 1, a, 0] <<[>[>+>+<<-]>>[<<+>>-]<<<-]  Cell 7 = prod(cell 5, cell 6) >[-]>[<<+>>-]<<<<-]  Move this value to cell 5. End while. >>[<<+>>-]+<[-]<<<<-]  Update x to result of exponentiation. End while. >>>. Print the result! 

This works (tested) for x 0, 0 x, x 1, 1 x, x 2, 2 3, and 2 4. I tried 3 3, but it ran for several hours without finishing (in my Java implementation—probably not optimal). In theory, this works up to the cell size of the specific implementation.

Cell 3 (0-indexed) is the running total x. This calculates the nth tetration of a.  +<<+<<,<, Initialize tape with [n, a, 0, 1, 0, 1] [ While n:  >[>+>>+<<<-]>[<+>-] Copy a 3 cells to right: [n, a, 0, x, a, 1] >[ While x:  >[>>+>+<<<-]>>>[<<<+>>>-] Copy a 2 cells to right: [n, a, 0, x, a, 1, a, 0]  <<[>[>+>+<<-]>>[<<+>>-]<<<-] Cell 7 = prod(cell 5, cell 6)  >[-]>[<<+>>-]<<<<-] Move this value to cell 5. End while.  >>[<<+>>-]+<[-]<<<<-] Update x to result of exponentiation. End while. >>>. Print the result! 

This works (tested) for x 0, 0 x, x 1, 1 x, x 2, 2 3, and 2 4. I tried 3 3, but it ran for several hours without finishing (in my Java implementation—probably not optimal) (EDIT: in @Timwi's EsotericIDE [It's great! Y'all should try it] as well. No luck.). In theory, this works up to the cell size of the specific implementation.

Fixed foolish mistake from long ago
Source Link

#Br**nfuck, 128-5=123 bytes

+<<+<<,<,[>[>+>>+<<<-]>[<+>-]>[>[>>+>+<<<-]>>>[<<<+>>>-]<<[>[>+>+<<-]>>[<<+>>-]<<<-]>[-]>[<<+>>-]<<<<-]>>[<<+>>-]+<[-]<<<<-]>>>. 

Input is in the form of characters with code points of the numbers desired as inputs. Output is the same.

An explanation is coming when I have the time below. Do I get bonus points for not using exponentiation, multiplication, OR even addition?

Cell 3 (0-indexed) is the running total x. +<<+<<,<, Initialize tape with [n, a, 0, 1, 0, 1] [ While n: >[>+>>+<<<-]>[<+>-] Copy a 3 cells to right: [n, a, 0, x, a, 1] >[ While x: >[>>+>+<<<-]>>>[<<<+>>>-] Copy a 2 cells to right: [n, a, 0, x, a, 1, a, 0] <<[>[>+>+<<-]>>[<<+>>-]<<<-] Cell 7 = prod(cell 5, cell 6) >[-]>[<<+>>-]<<<<-] Move this value to cell 5. End while. >>[<<+>>-]+<[-]<<<<-] Update x to result of exponentiation. End while. >>>. Print the result! 

This works (tested) for x 0, 0 x, x 1, 1 x, x 2, 2 3, and 2 4. I tried 3 3 and 2 4, but eachit ran for several hours without finishing (in my Java implementation—probably not optimal). In theory, this works up to the cell size of the specific implementation.

#Br**nfuck, 128-5=123 bytes

+<<+<<,<,[>[>+>>+<<<-]>[<+>-]>[>[>>+>+<<<-]>>>[<<<+>>>-]<<[>[>+>+<<-]>>[<<+>>-]<<<-]>[-]>[<<+>>-]<<<<-]>>[<<+>>-]+<[-]<<<<-]>>>. 

Input is in the form of characters with code points of the numbers desired as inputs. Output is the same.

An explanation is coming when I have the time below. Do I get bonus points for not using exponentiation, multiplication, OR even addition?

Cell 3 (0-indexed) is the running total x. +<<+<<,<, Initialize tape with [n, a, 0, 1, 0, 1] [ While n: >[>+>>+<<<-]>[<+>-] Copy a 3 cells to right: [n, a, 0, x, a, 1] >[ While x: >[>>+>+<<<-]>>>[<<<+>>>-] Copy a 2 cells to right: [n, a, 0, x, a, 1, a, 0] <<[>[>+>+<<-]>>[<<+>>-]<<<-] Cell 7 = prod(cell 5, cell 6) >[-]>[<<+>>-]<<<<-] Move this value to cell 5. End while. >>[<<+>>-]+<[-]<<<<-] Update x to result of exponentiation. End while. >>>. Print the result! 

This works (tested) for x 0, 0 x, x 1, 1 x, x 2, 2 3, and 2 4. I tried 3 3 and 2 4, but each ran for several hours without finishing (in my Java implementation—probably not optimal). In theory, this works up to the cell size of the specific implementation.

#Br**nfuck, 128-5=123 bytes

+<<+<<,<,[>[>+>>+<<<-]>[<+>-]>[>[>>+>+<<<-]>>>[<<<+>>>-]<<[>[>+>+<<-]>>[<<+>>-]<<<-]>[-]>[<<+>>-]<<<<-]>>[<<+>>-]+<[-]<<<<-]>>>. 

Input is in the form of characters with code points of the numbers desired as inputs. Output is the same.

An explanation is coming when I have the time below. Do I get bonus points for not using exponentiation, multiplication, OR even addition?

Cell 3 (0-indexed) is the running total x. +<<+<<,<, Initialize tape with [n, a, 0, 1, 0, 1] [ While n: >[>+>>+<<<-]>[<+>-] Copy a 3 cells to right: [n, a, 0, x, a, 1] >[ While x: >[>>+>+<<<-]>>>[<<<+>>>-] Copy a 2 cells to right: [n, a, 0, x, a, 1, a, 0] <<[>[>+>+<<-]>>[<<+>>-]<<<-] Cell 7 = prod(cell 5, cell 6) >[-]>[<<+>>-]<<<<-] Move this value to cell 5. End while. >>[<<+>>-]+<[-]<<<<-] Update x to result of exponentiation. End while. >>>. Print the result! 

This works (tested) for x 0, 0 x, x 1, 1 x, x 2, 2 3, and 2 4. I tried 3 3, but it ran for several hours without finishing (in my Java implementation—probably not optimal). In theory, this works up to the cell size of the specific implementation.

Changed stuff.
Source Link
Loading
Added some more confirmed test cases
Source Link
Loading
Added explanation
Source Link
Loading
Source Link
Loading