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!)
A290977 First n-digit number to appear twice in a row in the decimal expansion of Pi. 2

%I #75 Jan 11 2022 02:17:29

%S 3,59,209,9314,64015,886287,7348278,85105027

%N First n-digit number to appear twice in a row in the decimal expansion of Pi.

%C 209209 and 305305 appear in Pi before any 2-digit number appears twice in a row.

%C a(n) (n >= 1) begins at the following decimal places: 24, 413, 326, 8239, 107472, 1632152, 9719518. - _Robert G. Wilson v_, Aug 23 2017

%H David G. Andersen, <a href="http://www.angio.net/pi/piquery">The Pi-Search Page</a>.

%e a(1) = 3 because 3 is the first 1-digit number to appear twice in a row in the decimal expansion of Pi = 3.14159265358979323846264(33)...

%t With[{s = Rest@ First@ RealDigits[N[Pi, 10^4]]}, Keys@ Merge[#, Identity] &@ Table[If[Length@ # > 0, TakeSmallest[#, 1], 0 -> 0] &@ Sort[Map[#[[1, 1]] &, DeleteCases[#, {}]]] &@ Map[SequenceCases[#, {a_, b_} /; b == a + n] &, KeyMap[FromDigits, PositionIndex@ Partition[s, n, 1]]], {n, 4}]] (* _Michael De Vlieger_, Aug 16 2017 *)

%t pi = StringDrop[ ToString[ N[Pi, 1632200]], 2]; f[n_] := Block[{k = 1}, While[ StringTake[pi, {k, k +n -1}] != StringTake[pi, {k +n, k +2n -1}], k++]; k]; Array[f, 6] (* _Robert G. Wilson v_, Aug 17 2017 *)

%o (PARI) eva(n) = subst(Pol(n), x, 10)

%o pistring(n) = default(realprecision, n+10); my(x=Pi); floor(x*10^n)

%o pidigit(n) = pistring(n)-10*pistring(n-1)

%o consecpidigits(pos, len) = my(v=vector(len)); for(k=1, len, v[k]=pidigit(pos+k)); v

%o a(n) = my(v=[], w=[], x=1); while(1, v=consecpidigits(x, n); w=consecpidigits(x+n, n); if(v==w, return(eva(v))); x++) \\ _Felix Fröhlich_, Aug 16 2017

%o (Python)

%o from sympy import S

%o # download https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt, then

%o # with open('pi-billion.txt', 'r') as f: pi_digits = f.readline()

%o pi_digits = str(S.Pi.n(3*10**5+2))[:-2] # alternative to above

%o pi_digits = pi_digits.replace(".", "")

%o def a(n):

%o for k in range(1, len(pi_digits)-n):

%o s = pi_digits[k:k+2*n]

%o if s[0] != 0 and s[:len(s)//2] == s[len(s)//2:]:

%o return int(s[:len(s)//2])

%o print([a(n) for n in range(1, 6)]) # _Michael S. Branicky_, Jan 10 2022

%Y Cf. A000796, A287994, A290984.

%Y Cf. A050279, A096755, A096756, A096757, A096758, A096759, A096760, A096761, A096762, A096763.

%K base,more,nonn

%O 1,1

%A _Bobby Jacobs_, Aug 16 2017

%E a(6) from _Robert G. Wilson v_, Aug 19 2017

%E a(7) from _Bobby Jacobs_, Aug 22 2017

%E a(8) from _Michael S. Branicky_, Jan 10 2022

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 24 07:05 EDT 2024. Contains 371920 sequences. (Running on oeis4.)