Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #14 Jul 04 2023 12:08:49
%S 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,
%T 15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,
%U 27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34
%N Number of distinct digits needed to write n in all bases >= 2.
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1, 1, -1).
%F For n >= 3, a(n) = floor((n + 3)/2).
%F 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
%e 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.
%t Table[Length[Union@ Flatten@ Map[IntegerDigits[n, #] &, Range[2, n + 1]] /. {} -> {0}], {n, 0, 120}] (* or *)
%t 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 *)
%t 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 *)
%o (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
%Y Cf. A008619, A266977.
%K nonn,base
%O 0,3
%A _Gionata Neri_, Mar 09 2016