editing
approved
editing
approved
P:=proc(n, h) local a, j, k: a:=convert(n, base, h): for k from 1 to nops(a)-1 do
for k from 1 to nops(a)-1 do
if add(a[j]*(k-j), j=1..k)=add(a[j]*(j-k), j=k+1..nops(a)) then RETURN(n); break:
RETURN(n); break: fi: od: end: seq(P(i, 9), i=1..10^3);
with(numtheory): P:=proc(q, n, h) local a, b, d, j, k, : a:=convert(n, s; base, h): for k from 1 to nops(a)-1 do
for n from 1 to q do a:=convert(n, base, h);
for k from 1 to trunc(nops(a)/2) do b:=a[k]; a[k]:=a[nops(a)-k+1]; a[nops(a)-k+1]:=b; od;
for k from 2 to nops(a)-1 do d:=0; s:=0;
for j from 1 to k-1 do if a[j]>0 then s:=s+a[j]*(k-j); fi; od; for j from nops(a) by -1 to k+1 do
if add(a[j]>0 then d:*(k-j), j=1..k)=d+add(a[j]*(j-k); fi; od; if d, j=s k+1..nops(a)) then printRETURN(n); break; fi; od; od; end: P(10^9, 9);
fi: od: end: seq(P(i, 9), i=1..10^3);
approved
editing
proposed
approved
editing
proposed
Numbers with this property in all the bases from 2 to 9 are:
898958160865, 1518029154732,... - Giovanni Resta, Feb 13 2017
All the palindromic numbers in base 9 with an odd number of digits belong to the sequence.
Paolo P. Lava, <a href="/A282114/b282114.txt">Table of n, a(n) for n = 1..10000</a>
with(numtheory): P:=proc(q, h) local a, b, c, d, i, j, k, ok, n, s; for n from 1 to q do a:=convert(n, base, h);
for n from 1 to q do a:=convert(n, base, h);