login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A239316 Index of the first occurrence of a string of exactly n consecutive odd digits in the decimal expansion of Pi. 2
18, 1, 4, 13, 282, 342, 783, 43, 4424, 412, 940, 8337, 44968, 61667, 33821, 106904, 336404, 421527, 31488, 1850725, 5854551, 8996526, 11709660, 2493200, 105887707, 86401248, 701257139, 546257302, 92438127 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
EXAMPLE
Digit: 1 2 3 4 5 6 7 8 9 10 11 12 ...18 ...
Pi: 3 1 4 1 5 9 2 6 5 3 5 8 ....3 ...
Odd string: [2]...[ 3 ].....[ 3 ].......[1]...
. . .
. . .
a(2) a(3) a(1)
= 1 = 4 = 18
MATHEMATICA
a239316[n_, checkDigits_: 100000] :=
Block[{foundPos,
piDigitBooleans = {#1[[1]],
Length[#]} & /@ (OddQ /@
RealDigits[N[Pi, checkDigits]][[1, 1 ;; All]] // Split)},
foundPos = FirstPosition[piDigitBooleans, {True, n}][[1]];
If[! NumericQ[foundPos],
Return["Not found within " <> ToString[checkDigits] <> " digits"]];
Total[piDigitBooleans[[1 ;; foundPos]][[All, 2]]] - n + 1]
a239316[#] & /@ Range[1, 15] (* Julien Kluge, Jan 31 2016 *)
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 == 1:#digit is odd
................now += 1
............else:
................now = 0
............if now == a and c%2 == 0:
................print(a, place-a+2)
................found = True
................break
............place += 1
........if not found:
............print("Not found in first billion digits.")
# pib.txt is the first billion digits of pi, readily available online
# David Consiglio, Jr., Sep 22 2014
CROSSREFS
Sequence in context: A040334 A040333 A040335 * A040336 A040337 A152209
KEYWORD
nonn,base
AUTHOR
Kival Ngaokrajang, Mar 15 2014
EXTENSIONS
More terms from David Consiglio, Jr., Sep 22 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 22:36 EDT 2024. Contains 371917 sequences. (Running on oeis4.)