[go: up one dir, main page]

login
A241502
Consider a non-palindromic 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 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).
5
324, 648, 756, 4448, 4961, 4983, 5849, 11124, 34453, 37609, 54575, 97888, 860858, 1089693, 3143632, 3192897, 3588047, 3768167, 5557853, 25485909, 32899939, 35699309, 58260393, 64564422, 120054389, 121554165, 356346023, 357507563, 755438130, 990227314
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