|
|
A239317
|
|
Index of the first occurrence of a string of exactly n even numbers in the decimal expansion of Pi.
|
|
1
|
|
|
3, 7, 53, 117, 33, 19, 965, 372, 1834, 70, 5876, 8878, 9288, 1279, 173580, 248625, 652113, 678288, 2199379, 1656691, 3455554, 30021792, 18707922, 26568757, 189709607, 36454145, 255896738, 388817627
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
a(29) > 10^9
The string of even digits of length n must be preceded and followed by an odd digit. - Harvey P. Dale, Jan 27 2022
|
|
LINKS
|
|
|
EXAMPLE
|
Digit: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
Pi: 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 ...
Even string: ...[1]......[2].........[1]............
. .
. .
a(1) a(2)
= 3 = 7
|
|
MATHEMATICA
|
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 *)
|
|
PROG
|
(Python)
with open("pib.txt") as f:
....digits = f.read(1000000000)
....for a in range(1, 30):
........found = False
........place = 0
........now = 0
........while place < 999999999:
............b = int(digits[place])
............c = int(digits[place+1])
................if b % 2 == 0:#digit is odd
....................now += 1
................else:
....................now = 0
................if now == a and c%2 == 1:
....................print(a, place-a+2)
....................found = True
....................break
................place += 1
........if not found:
............print("Not found in first billion digits.")
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,more,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|