37 lines
888 B
Text
37 lines
888 B
Text
func Humble(N); \Return 'true' if N is a humble number
|
|
int N;
|
|
[if N = 1 then return true;
|
|
if rem(N/2) = 0 then return Humble(N/2);
|
|
if rem(N/3) = 0 then return Humble(N/3);
|
|
if rem(N/5) = 0 then return Humble(N/5);
|
|
if rem(N/7) = 0 then return Humble(N/7);
|
|
return false;
|
|
];
|
|
|
|
int N, C, D, P;
|
|
[N:= 1; C:= 0;
|
|
loop [if Humble(N) then
|
|
[C:= C+1;
|
|
IntOut(0, N); ChOut(0, ^ );
|
|
if C >= 50 then quit;
|
|
];
|
|
N:= N+1;
|
|
];
|
|
CrLf(0);
|
|
D:= 1; P:= 10; N:= 1; C:= 0;
|
|
loop [if Humble(N) then
|
|
[if N >= P then
|
|
[IntOut(0, D);
|
|
Text(0, ": ");
|
|
IntOut(0, C);
|
|
CrLf(0);
|
|
C:= 0;
|
|
D:= D+1;
|
|
if D > 9 then quit;
|
|
P:= P*10;
|
|
];
|
|
C:= C+1;
|
|
];
|
|
N:= N+1;
|
|
];
|
|
]
|