Factorions: Difference between revisions
Content added Content deleted
m (→{{header|jq}}: simplify) |
|||
Line 1,559: | Line 1,559: | ||
The factorions for base 12 are: 1 2 |
The factorions for base 12 are: 1 2 |
||
</pre> |
|||
=={{header|RPL}}== |
|||
{{trans|C}} |
|||
{{works with|Halcyon Calc|4.2.7}} |
|||
{| class="wikitable" |
|||
! Code |
|||
! Comments |
|||
|- |
|||
| |
|||
≪ |
|||
{ } 1 11 '''FOR''' n n FACT + '''NEXT''' → base fact |
|||
≪ { } 1 1500000 '''FOR''' n |
|||
0 n '''WHILE''' DUP '''REPEAT''' |
|||
fact OVER base MOD 1 MAX GET |
|||
ROT + SWAP |
|||
base / IP |
|||
'''END''' DROP |
|||
'''IF''' n == '''THEN''' n + '''END''' |
|||
'''NEXT''' |
|||
≫ ≫ ‘FTRION’ STO |
|||
| |
|||
''( base -- { factorions } )'' |
|||
Cache 1! to 11! |
|||
Loop until all digits scanned |
|||
Get (last digit)! even if last digit = 0 |
|||
Add to sum of digits |
|||
prepare next loop |
|||
Store factorion |
|||
|} |
|||
The following lines of command deliver what is required: |
|||
9 FTRION |
|||
10 FTRION |
|||
11 FTRION |
|||
12 FTRION |
|||
{{out}} |
|||
<pre> |
|||
4: { 1 2 41282 } |
|||
3: { 1 2 145 40585 } |
|||
2: { 1 2 26 48 40472 } |
|||
1: { 1 2 } |
|||
</pre> |
</pre> |
||