OFFSET
0,1
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
EXAMPLE
For n = 4:
- in base 2, 1 and 4 have the same sum of digits,
- in base 3, 2 and 4 have the same sum of digits,
- in base 4, 1 and 4 have the same sum of digits,
- in base 5, 4 is the least number with its sum of digits,
- hence a(4) = 5.
MAPLE
N:= 100: # for a(0)..a(N)
V:= Array(0..N):
V[0]:= 2: count:= 1:
for b from 2 while count < N+1 do
for d from 1 to ilog[b]((N+1)/2)+2 do
for s from (d-1)*(b-1)+1 to d*(b-1) do
i:= s-(d-1)*(b-1);
x:= (i+1)*b^(d-1)-1;
if x > N then break fi;
if V[x] = 0 then V[x]:= b; count:= count+1 fi;
od od od:
convert(V, list); # Robert Israel, Jun 27 2023
PROG
(PARI) a(n) = { for (b=2, oo, my (s=sumdigits(n, b)); if (n==((s%(b-1))+1)*b^(s\(b-1))-1, return (b))) }
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Sep 21 2019
STATUS
approved