def LenSV = 2_000_000_000 + 9*9 + 1; func Sieve; char SV; int N, S(8), A, B, C, D, E, F, G, H, I, J; [SV:= MAlloc(LenSV); N:= 0; for A:= 0 to 1 do [for B:= 0 to 9 do [S(0):= A + B; for C:= 0 to 9 do [S(1):= S(0) + C; for D:= 0 to 9 do [S(2):= S(1) + D; for E:= 0 to 9 do [S(3):= S(2) + E; for F:= 0 to 9 do [S(4):= S(3) + F; for G:= 0 to 9 do [S(5):= S(4) + G; for H:= 0 to 9 do [S(6):= S(5) + H; for I:= 0 to 9 do [S(7):= S(6) + I; for J:= 0 to 9 do [SV(S(7)+J+N):= true; N:= N+1; ] ] ] ] ] ] ] ] ] ]; return SV; ]; char SV; int ST, Count, I; [ST:= GetTime; SV:= Sieve; Count:= 0; Text(0, "The first 50 self numbers are:^m^j"); for I:= 0 to LenSV-1 do [if SV(I) = false then [Count:= Count+1; if Count <= 50 then [IntOut(0, I); ChOut(0, ^ )]; if Count = 100_000_000 then [Text(0, "^m^j^m^jThe 100 millionth self number is "); IntOut(0, I); CrLf(0); I:= LenSV; ]; ]; ]; Text(0, "Took "); RlOut(0, float(GetTime-ST) / 1e6); CrLf(0); ]