OFFSET
0,3
LINKS
Index entries for linear recurrences with constant coefficients, signature (1, 1, -1).
FORMULA
For n >= 3, a(n) = floor((n + 3)/2).
G.f.: 1 + (x*(1 + 2*x - x^2 - 2*x^3 + x^4))/((-1 + x)^2*(1 + x)). - Michael De Vlieger, Mar 09 2016
EXAMPLE
4 written in all bases 2,3,4,5,6,7,... is 100,11,10,4,4,4,... and the distinct digits needed are 0, 1 and 4, so a(4) = 3.
MATHEMATICA
Table[Length[Union@ Flatten@ Map[IntegerDigits[n, #] &, Range[2, n + 1]] /. {} -> {0}], {n, 0, 120}] (* or *)
Table[Length[Union@ Flatten@ Map[IntegerDigits[n, #] &, Range[2, n + 1]] /. {} -> {0}], {n, 0, 2}]~Join~Table[Floor[(n + 3)/2], {n, 3, 120}] (* or *)
CoefficientList[Series[1 + (x (1 + 2 x - x^2 - 2 x^3 + x^4))/((-1 + x)^2 (1 + x)), {x, 0, 120}], x] (* Michael De Vlieger, Mar 09 2016 *)
PROG
(PARI) a(n) = {if (n <= 1, 1, v = []; for (b=2, n+1, v = vecsort(concat(v, digits(n, b)), , 8)); #v; ); } \\ Michel Marcus, Mar 09 2016
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Gionata Neri, Mar 09 2016
STATUS
approved