A288291
Position of the first time an n-digit number appears twice in a row after the decimal point of e.
Original entry on oeis.org
31, 49, 97, 2, 112869, 5005575, 1561314, 69682897, 1841794338
Offset: 1
a(1) = 31 because the first time a 1-digit number appears twice in a row in the decimal expansion of e is 31 digits after the decimal point: 2.718281828459045235360287471352(66)...
-
s = First@ RealDigits[E, 10, 51*^5]; Table[p = Partition[s, k, 1];
SelectFirst[ Range[ Length[p] - k], p[[#]] == p[[# + k]] &] - 1, {k, 7}] (* Giovanni Resta, Sep 05 2017 *)
A290977
First n-digit number to appear twice in a row in the decimal expansion of Pi.
Original entry on oeis.org
3, 59, 209, 9314, 64015, 886287, 7348278, 85105027
Offset: 1
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)...
-
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 *)
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 *)
-
eva(n) = subst(Pol(n), x, 10)
pistring(n) = default(realprecision, n+10); my(x=Pi); floor(x*10^n)
pidigit(n) = pistring(n)-10*pistring(n-1)
consecpidigits(pos, len) = my(v=vector(len)); for(k=1, len, v[k]=pidigit(pos+k)); v
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
-
from sympy import S
# download https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt, then
# with open('pi-billion.txt', 'r') as f: pi_digits = f.readline()
pi_digits = str(S.Pi.n(3*10**5+2))[:-2] # alternative to above
pi_digits = pi_digits.replace(".", "")
def a(n):
for k in range(1, len(pi_digits)-n):
s = pi_digits[k:k+2*n]
if s[0] != 0 and s[:len(s)//2] == s[len(s)//2:]:
return int(s[:len(s)//2])
print([a(n) for n in range(1, 6)]) # Michael S. Branicky, Jan 10 2022
Showing 1-2 of 2 results.
Comments