19 lines
561 B
Text
19 lines
561 B
Text
int N, Base, Digit, I, J, Sum, Factorial(12);
|
|
[Factorial(0):= 1; \cache factorials from 0 to 11
|
|
for N:= 1 to 12-1 do
|
|
Factorial(N):= Factorial(N-1)*N;
|
|
for Base:= 9 to 12 do
|
|
[Text(0, "The factorions for base "); IntOut(0, Base); Text(0, " are:^m^j");
|
|
for I:= 1 to 1_499_999 do
|
|
[Sum:= 0;
|
|
J:= I;
|
|
while J > 0 do
|
|
[Digit:= rem(J/Base);
|
|
Sum:= Sum + Factorial(Digit);
|
|
J:= J/Base;
|
|
];
|
|
if Sum = I then [IntOut(0, I); ChOut(0, ^ )];
|
|
];
|
|
CrLf(0); CrLf(0);
|
|
];
|
|
]
|