login
Consider the antisigma function of a number x, A024816(x). Take the sum of its digits. Repeat the process deleting the first addendum and adding the previous sum. The sequence lists the numbers that after some iterations reach x.
0

%I #6 Feb 23 2017 22:53:30

%S 10,15,17,57,68,520,525,547,789,894,3149,3700,3845,4272,8304,15792,

%T 63555,119926,121267

%N Consider the antisigma function of a number x, A024816(x). Take the sum of its digits. Repeat the process deleting the first addendum and adding the previous sum. The sequence lists the numbers that after some iterations reach x.

%e 68 * 69 / 2 - sigma(n) = 2220 and:

%e 2 + 2 + 2 + 0 = 6;

%e 2 + 2 + 0 + 6 = 10;

%e 2 + 0 + 6 + 10 = 18;

%e 0 + 6 + 10 + 18 = 34;

%e 6 + 10 + 18 + 34 = 68.

%p with(numtheory): P:=proc(q, h) local a, b, k, n, t, v; v:=array(1..h);

%p for n from 2 to q do a:=n*(n+1)/2-sigma(n); b:=ilog10(a)+1; if b>1 then

%p for k from 1 to b do v[b-k+1]:=(a mod 10); a:=trunc(a/10); od; t:=b+1; v[t]:=add(v[k], k=1..b);

%p while v[t]<n do t:=t+1; v[t]:=add(v[k], k=t-b..t-1); od;

%p if v[t]=n then print(n); fi; fi; od; end: P(10^6, 1000);

%Y Cf. A024816, A269307-A269312.

%K nonn,base,more

%O 1,1

%A _Paolo P. Lava_, Feb 20 2017