login
Consider a number of k digits n = d_(k)*10^(k-1) + d_(k-1)*10^(k-2) + … + d_(2)*10 + d_(1). Sequence lists the numbers n such that sigma(n)-n = Sum_{i=1..k-1}{sigma(Sum_{j=1..i}{d_(j)*10^(j-1)})} - Sum_{i=1..k-1}{sigma(Sum_{j=1..i}{d_(k-j+1)*10^(i-j)})} (see example below)
7

%I #13 Jan 03 2024 10:01:54

%S 23,47,142,161,433,1435,1900,6679,48917,197943,257941,3916321,

%T 48635983,1142976889,1811878288

%N Consider a number of k digits n = d_(k)*10^(k-1) + d_(k-1)*10^(k-2) + … + d_(2)*10 + d_(1). Sequence lists the numbers n such that sigma(n)-n = Sum_{i=1..k-1}{sigma(Sum_{j=1..i}{d_(j)*10^(j-1)})} - Sum_{i=1..k-1}{sigma(Sum_{j=1..i}{d_(k-j+1)*10^(i-j)})} (see example below)

%C a(16) > 10^10. - _Giovanni Resta_, May 23 2016

%e If n = 48917, starting from the least significant digit, let us cut the number into the set 7, 17, 917, 8917. We have:

%e sigma(7) = 8;

%e sigma(17) = 18;

%e sigma(917) = 1056;

%e sigma(8917) = 9196.

%e Then, starting from the most significant digit, let us cut the number into the set 4, 48, 489, 4891. We have:

%e sigma(4) = 7;

%e sigma(48) = 124;

%e sigma(489) = 656;

%e sigma(4891) = 5032.

%e Finally,

%e 8 + 18 + 1056 + 9196 - (7 + 124 + 656 + 5032) = 4459 = sigma(48917) - 48917.

%p with(numtheory); P:=proc(q) local a,b,k,n;

%p for n from 2 to q do a:=0; k:=1; while trunc(n/10^k)>0 do

%p a:=a+phi(trunc(n/10^k)); k:=k+1; od; b:=0; k:=1;

%p while (n mod 10^k)<n do b:=b+phi(n mod 10^k); k:=k+1; od;

%p if phi(n)=b-a then print(n); fi; od; end: P(10^9);

%Y Cf. A000203, A240894-A240903.

%K nonn,base,more

%O 1,1

%A _Paolo P. Lava_, Apr 17 2014

%E a(1)-a(2) corrected and a(12)-a(15) added by _Giovanni Resta_, May 23 2016