login
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).
1
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,1
COMMENTS
The first 6 terms also appear in A037008, the position of the digit 0 in the decimal expansion of Pi.
From Pontus von Brömssen, May 13 2025: (Start)
If the digit "3" before the decimal point is included (but a(n) still represents the number of digits after the decimal point), the first difference to this sequence (i.e., the first time the extra "3" is useful) would be a(229) = 2583 instead of 2597.
For d = 0, 1, ..., 9, the smallest n >= 1 for which d is the last digit to occur n times is 1, 146359, 2100, 229, 94, 61, 118, 7, 794, 9734, respectively.
(End)
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
Sequence in context: A383291 A256521 A037008 * A316943 A099048 A176542
KEYWORD
nonn,base
AUTHOR
Guy Amit, May 07 2025
STATUS
approved