23 lines
533 B
Text
23 lines
533 B
Text
program superd_numbers;
|
|
loop for d in [2..7] do
|
|
print("First 10 super-" + str d + " numbers:");
|
|
print(first_n_super_d(10, d));
|
|
print;
|
|
end loop;
|
|
|
|
proc first_n_super_d(n, d);
|
|
r := [];
|
|
i := 0;
|
|
loop while n>0 do
|
|
if is_super_d(i +:= 1, d) then
|
|
r with:= i;
|
|
n -:= 1;
|
|
end if;
|
|
end loop;
|
|
return r;
|
|
end proc;
|
|
|
|
proc is_super_d(n, d);
|
|
return (str d)*d in str (n**d * d);
|
|
end proc;
|
|
end program;
|