Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #12 Jun 27 2023 17:44:08
%S 2,2,3,2,5,3,7,2,3,5,11,4,13,7,5,2,17,3,19,5,7,11,23,6,5,13,3,7,29,6,
%T 31,2,11,17,7,6,37,19,13,8,41,7,43,11,9,23,47,4,7,5,17,13,53,3,11,8,
%U 19,29,59,10,61,31,9,2,13,11,67,17,23,10,71,6,73,37
%N a(n) is the least base >= 2 where n is the least number with its sum of digits.
%H Robert Israel, <a href="/A327667/b327667.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) = 2 iff n belongs to A000225.
%F A327664(n) <= a(n).
%F a(p-1) = p for any prime number p.
%e For n = 4:
%e - in base 2, 1 and 4 have the same sum of digits,
%e - in base 3, 2 and 4 have the same sum of digits,
%e - in base 4, 1 and 4 have the same sum of digits,
%e - in base 5, 4 is the least number with its sum of digits,
%e - hence a(4) = 5.
%p N:= 100: # for a(0)..a(N)
%p V:= Array(0..N):
%p V[0]:= 2: count:= 1:
%p for b from 2 while count < N+1 do
%p for d from 1 to ilog[b]((N+1)/2)+2 do
%p for s from (d-1)*(b-1)+1 to d*(b-1) do
%p i:= s-(d-1)*(b-1);
%p x:= (i+1)*b^(d-1)-1;
%p if x > N then break fi;
%p if V[x] = 0 then V[x]:= b; count:= count+1 fi;
%p od od od:
%p convert(V,list); # _Robert Israel_, Jun 27 2023
%o (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))) }
%Y Cf. A000225, A327664.
%K nonn,base,look
%O 0,1
%A _Rémy Sigrist_, Sep 21 2019