,[->+>+<<]>>[-<<+>>]++++++++[<------<------>>-]<[->>+>>+<<<<]>>[-<<+>>]>>-[-<<<<<[>[>+>+<<-]>>[<<+>>-]<<<-]>>[-<<+>>]>>>]<<<++++++++[-<<++++++>>]<<.
Try it online!
No built-ins ;)
How it works
, - get ascii input
[->+>+<<] - duplicate input
>>[-<<+>>] - shift inputs left to start
++++++++[<------<------>>-] - convert ascii into input numbers
<[->>+>>+<<<<] - get loop intervals (same as input #)
>>[-<<+>>] - shift input back again
>>-[-<<<<<[>[>+>+<<-]>>[<<+>>-]<<<-]>> - iterated addition (multiplication)
[-<<+>>]>>> - Shift output back into input
]<<<++++++++[-<<++++++>>]<<. - convert final output to ascii
In a nutshell, this works by multiplying x
(the input) by itself x
times. (a.k.a. iterating iterated addition). The net result is x^x.
I/O
The program takes a single ASCII input, and processes it as it's ASCII index minus 48. The minus 48 is to normalize inputs of actual numbers (4
becomes 52
-> 52-48
-> 4
). To input a number higher than 9, use the next corrosponging ASCII character (:
-> 58-48
-> 10
). The program ouputs in a similar fashion.
Test I/O
INPUT > PROCESSED INPUT >> OUTPUT > TRANSLATED OUTPUT
1 > 1 >> 1 > 1
2 > 2 >> 4 > 4
3 > 3 >> K > 27
Since there are no printable ASCII characters after an input of 3, it can only print numbers in theory. Though, you can check all inputs do in fact work on visualizers such as this.