A383732 a(n) is the smallest k such that every digit from 0 to 9 appears at least n times among the first k digits of Pi (after the decimal point).
32, 50, 54, 65, 71, 77, 96, 99, 120, 139, 156, 166, 209, 224, 232, 235, 242, 288, 299, 301, 306, 320, 343, 351, 405, 407, 412, 429, 439, 452, 458, 463, 468, 475, 478, 486, 506, 538, 540, 544, 548, 556, 559, 560, 567, 569, 575, 577, 584, 591, 609, 621, 622, 625, 626, 631, 633, 634, 641
Offset: 1
Examples
For n = 1, a(1) = 32 since this is the first position in the decimal expansion of Pi such that every digit from 0 to 9 has appeared at least once among the first 32 digits. For n = 2, a(2) = 50 since this is the first position in the decimal expansion of Pi such that every digit from 0 to 9 has appeared at least twice among the first 50 digits.
Links
- Guy Amit, Table of n, a(n) for n = 1..10000
Programs
-
MATLAB
% Assuming x contains the digits of Pi, x = [1, 4, 1, 5, 9, ...] a = nan(1); counts = zeros(10, 1); n = 1; for i = 1:length(x) for j = 1:10 if x(i) == (j-1) counts(j) = counts(j) + 1; end end if sum(counts>=n) == 10 a(n) = i; n = n + 1; end end
-
Mathematica
piDigit = Rest[RealDigits[Pi, 10, 700][[1]]]; f[pd_List]:=Module[{res,len,count,n=1},count=CreateDataStructure["FixedArray",ConstantArray[0,10]];res=CreateDataStructure["Queue"];len=Length[pd]; Do[Do[If[pd[[i]]==j-1,count["SetPart",j,1+count["Part",j]]],{j,10}];If[Total[Boole[#>=n]&/@(count["Elements"])]==10,res["Push",i];n++],{i,len}];res["Elements"]];f[piDigit] (* Shenghui Yang, May 19 2025 *) (* or *) upto[nd_] := Block[{pi=Rest@ RealDigits[Pi,10,nd][[1]], cnt=0 Range[10], n=1}, Reap[Do[cnt[[pi[[j]] + 1]]++; If[Min[cnt-n] == 0, n++; Sow@j], {j, Length@ pi}]][[2,1]]]; upto[700] (* for older Mma, Giovanni Resta, May 22 2025 *)
Comments