login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A270059
Number of distinct digits needed to write n in all bases >= 2.
0
1, 1, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34
OFFSET
0,3
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
Sequence in context: A361469 A073750 A378658 * A120204 A177018 A156349
KEYWORD
nonn,base
AUTHOR
Gionata Neri, Mar 09 2016
STATUS
approved