Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Factorions/XPL0/factorions.xpl0
Normal file
19
Task/Factorions/XPL0/factorions.xpl0
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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);
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue