OFFSET
1,1
EXAMPLE
If n = 54575, starting from the least significant digit, let us cut the number into the set 5, 75, 575, 4575. We have:
sigma(5) = 6;
sigma(75) = 124;
sigma(575) = 744;
sigma(4575) = 7688.
Then, starting from the most significant digit, let us cut the number into the set 5, 54, 545, 5457. We have:
sigma(5) = 6;
sigma(54) = 120;
sigma(545) = 660;
sigma(5457) = 7776.
Finally, 6 + 124 + 744 + 7688 = 6 + 120 + 660 + 7776 = 8562.
MAPLE
with(numtheory); P:=proc(q) local a, b, k, n; for n from 2 to q do
a:=0; k:=1; while trunc(n/10^k)>0 do a:=a+sigma(trunc(n/10^k)); k:=k+1; od;
b:=0; k:=1; while (n mod 10^k)<n do b:=b+sigma(n mod 10^k); k:=k+1; od;
if a=b then a:=0; b:=n; while b>0 do a:=10*a+(b mod 10); b:=trunc(b/10); od;
if a<>n then print(n); fi; fi; od; end: P(10^9);
# alternative
for n from 1 do
if not isA002113(n) then
dgs := convert(n, base, 10) ;
ndgs := nops(dgs) ;
slo := 0 ;
shi := 0 ;
for sd from 1 to ndgs-1 do
lo := add( op(i, dgs)*10^(i-1), i=1..sd) ;
slo := slo + numtheory[sigma](lo) ;
hi := add( op(-i, dgs)*10^(sd-i), i=1..sd) ;
shi := shi + numtheory[sigma](hi) ;
end do:
if slo = shi then
print(n) ;
end if;
end if;
end do: # R. J. Mathar, Sep 09 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Paolo P. Lava, Apr 24 2014
EXTENSIONS
a(16)-a(30) from Giovanni Resta, May 23 2016
STATUS
approved