The winner (pretty obviously) is Dennis ♦, who used Jelly with 10 bytes!
This challenge will still be up here, however results won't be taken anymore.
The powertrain of a number is a concept by John Conway (who is also notable for making Conway's Game of Life, but that's not the point). It is defined as so:
2592 => (2^5)(9^2) = 2592 <= Cannot be further decomposed
135 => (1^3)5 = 5
1234 => (1^2)(3^4) = 81 => (8^1) = 8
1100 => (1^1)(0^0) = 1 # (0^0) = 1
-42 => -42 # Negative numbers output the input
Your challenge is, for any number
n in the input, return
n after the powertrain decomposition is finished) as output.
This is code golf, so shortest amount of bytes wins.
- You can have an odd number of digits in the input, the last digit just won't have a power.
- 0^0 is 1, because if it was 0, then a lot of numbers would instantly collapse to 0 or 1.
- If the number is indestructible in any part of the computation process (e.g. if it ends up with
2592), then you can just output the number.
- If the input is
< 10(i.e. all single digit numbers and negatives), output the input.
I'll probably announce a winner after a few
- Jelly (Dennis ♦): 10
- Pyth (DenkerAffe): 16
- MATL (Don Muesli): 21
- Perl (Ton Hospel): 42
- Haskell (Damien): 64
- Mathematica (murphy): 74
- Mathematica (LegionMammal978) and Haskell (Renzeee): 77
- Python 2 (mathmandan): 111
- Python 3 (Erwan): 161
- Java 8 (Blue): 229
- Oracle SQL 11.2 (Jeto): 456
- Befunge '93 (Lex): 490