cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A239317 Index of the first occurrence of a string of exactly n even numbers in the decimal expansion of Pi.

This page as a plain text file.
%I A239317 #26 May 10 2025 09:15:40
%S A239317 3,7,53,117,33,19,965,372,1834,70,5876,8878,9288,1279,173580,248625,
%T A239317 652113,678288,2199379,1656691,3455554,30021792,18707922,26568757,
%U A239317 189709607,36454145,255896738,388817627
%N A239317 Index of the first occurrence of a string of exactly n even numbers in the decimal expansion of Pi.
%C A239317 a(29) > 10^9
%C A239317 The string of even digits of length n must be preceded and followed by an odd digit. - _Harvey P. Dale_, Jan 27 2022
%e A239317 Digit:         1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
%e A239317 Pi:            3 1 4 1 5 9 2 6 5  3  5  8  9  7  9 ...
%e A239317 Even string:   ...[1]......[2].........[1]............
%e A239317                    .        .
%e A239317                    .        .
%e A239317                   a(1)     a(2)
%e A239317                   = 3      = 7
%t A239317 Module[{nn=389*10^6,dep},dep=If[EvenQ[#],1,0]&/@RealDigits[Pi,10,nn][[1]];Table[SequencePosition[dep,Join[{0},PadLeft[{0},n,1]],1][[1]],{n,2,29}][[All,1]]]+1 (* _Harvey P. Dale_, Jan 27 2022 *)
%o A239317 (Python)
%o A239317 # Requires a text file "pib.txt" that contains the first billion digits of pi
%o A239317 # without a decimal point or line breaks
%o A239317 with open("pib.txt") as f:
%o A239317     digits = f.read(1000000000)
%o A239317     for a in range(1,30):
%o A239317         found = False
%o A239317         place = 0
%o A239317         now = 0
%o A239317         while place < 999999999:
%o A239317             b = int(digits[place])
%o A239317             c = int(digits[place+1])
%o A239317             if b % 2 == 0:#digit is odd
%o A239317                 now += 1
%o A239317             else:
%o A239317                 now = 0
%o A239317             if now == a and c%2 == 1:
%o A239317                 print(a,place-a+2)
%o A239317                 found = True
%o A239317                 break
%o A239317             place += 1
%o A239317         if not found:
%o A239317             print("Not found in first billion digits.")
%o A239317 # _David Consiglio, Jr._, Sep 22 2014
%o A239317 # indentation corrected by _David Radcliffe_, May 09 2025
%Y A239317 Cf. A000796, A057680, A239316.
%K A239317 nonn,more,base
%O A239317 1,1
%A A239317 _Kival Ngaokrajang_, Mar 15 2014
%E A239317 More terms from _David Consiglio, Jr._, Sep 22 2014
%E A239317 Corrected and definition clarified by _Harvey P. Dale_, Jan 27 2022