login
Numbers k such that d(1)^0 + d(2)^1 + ... + d(p)^(p-1) = d(1)^(p-1) + d(2)^(p-2) + ... + d(p)^0, where d(i), i=1..p, are the digits of k.
3

%I #37 Aug 04 2024 03:20:15

%S 1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99,101,111,121,131,141,151,

%T 161,171,181,191,202,212,222,232,242,252,262,272,282,292,303,313,323,

%U 333,343,353,363,373,383,393,404,414,424,434,444,454,464

%N Numbers k such that d(1)^0 + d(2)^1 + ... + d(p)^(p-1) = d(1)^(p-1) + d(2)^(p-2) + ... + d(p)^0, where d(i), i=1..p, are the digits of k.

%C This sequence starts off like other palindromic sequences such as A178354, A002113, A110751, and A227858 but it differs starting at the 110th term: 109th: 1001, 110th: 1011, 111th: 1101, ..., 119th: 1863, etc.

%C Differs from A297271 (which e.g. has 1021, 1031, 1041,.. 1091 which are absent here). - _R. J. Mathar_, Sep 27 2021

%C Contains the palindromes, and palindromes where pairs of digits have been substituted by d(i)=0, d(p-i)=1 or d(i)=1, d(p-1)=0, and "genuine" numbers like 1863, 2450, 2804, 2814, 3681, 4081, 4182, 103221, 113221, 122301, 122311, 142023,.. - _R. J. Mathar_, Sep 27 2021

%H R. J. Mathar, <a href="/A342826/b342826.txt">Table of n, a(n) for n = 1..1137</a> (replacing older b-file which did not contain a(101))

%H Carole Dubois, <a href="/A342826/a342826.jpg">Scatterplot of terms of A178354, A342826 vs Sum of powers in definition.</a>

%e 1863 is in this sequence because 1^0 + 8^1 + 6^2 + 3^3 = 1^3 + 8^2 + 6^1 + 3^0 = 72.

%p isA342826 := proc(n)

%p local dgs ;

%p dgs := convert(n,base,10) ;

%p if add(op(i,dgs)^(i-1),i=1..nops(dgs)) = add(op(-i,dgs)^(i-1),i=1..nops(dgs)) then

%p true;

%p else

%p false;

%p end if;

%p end proc:

%p A342826 := proc(n)

%p option remember ;

%p if n =1 then

%p 1;

%p else

%p for a from procname(n-1)+ 1 do

%p if isA342826(a) then

%p return a;

%p end if;

%p end do:

%p end if;

%p end proc: # _R. J. Mathar_, Sep 27 2021

%t Select[Range[500],Mod[#,10]!=0&&Total[IntegerDigits[#]^Range[0,IntegerLength[ #]-1]]==Total[IntegerDigits[#]^Range[IntegerLength[#]-1,0,-1]]&] (* _Harvey P. Dale_, Jan 18 2023 *)

%o (Python)

%o def digpow(s): return sum(int(d)**i for i, d in enumerate(s))

%o def aupto(limit):

%o alst = []

%o for k in range(1, limit+1):

%o s = str(k)

%o if digpow(s) == digpow(s[::-1]): alst.append(k)

%o return alst

%o print(aupto(464)) # _Michael S. Branicky_, Mar 23 2021

%Y Cf. A002113 (subset), A179309, A110751, A227858.

%K nonn,base

%O 1,2

%A _Carole Dubois_, Mar 23 2021