with(numtheory): P:=proc(q) local a, b, c, k, n, p, x; x:=array(1..50);
for n from 1 to 50 do x[n]:=0; od; x[1]:=1; lprint(0, 1); lprint(1, 0);
for n from 1 to q do c:=0; for k from 0 to trunc(n/2) do
a:=k*add(op(2, p)/op(1, p), p=ifactors(k)[2]);
b:=(n-k)*add(op(2, p)/op(1, p), p=ifactors(n-k)[2]);
if a+b=n then c:=c+1; fi; od; if c>0 then if x[c]=0 then
x[c]:=n; lprint(c, x[c]); fi; fi; od; end: P(10^9);
# program presents a(n) not in order but as they first appear
|