login
First n-digit square in the digits of e.
0

%I #12 Dec 29 2022 06:32:01

%S 1,81,676,8281,72900,819025,21609,3644281,59845696,796707076,

%T 2113884529,736205184576,1751509314916,1751509314916,5176216516900,

%U 4737309139140769,99398242392417424,887828157705424896,8576326547254681744,2583667059970281481

%N First n-digit square in the digits of e.

%C Squares are allowed to have prefix 0 (see example).

%C a(18)-a(20) require 1.6, 2, 4.9 billion digits, respectively. - _Michael S. Branicky_, Dec 28 2022

%e a(7) = 21609 is the first square that occurs in the sequence of the 7 decimal digits ...0021609...with the index 830 in A001113.

%p Digits := 10000: p0 := evalf(exp(1)):for d from 1 to 20 do: id:=0:for i from

%p 0 to 50000 while(id=0) do :q0:=trunc(p0*10^(i+d-1)): x:= irem(q0,10^d): if sqrt(x)=floor(sqrt(x)) then printf(`%d, `,x):id:=1: else fi:od:od:

%o (Python)

%o from math import isqrt

%o from sympy import E, isprime

%o e = str(E.n(10**5))[2:] # or load from file using the pattern:

%o # with open('e.txt', 'r') as f: digits_of_e = f.readline()[2:]

%o def a(n): return next((t for k in range(len(e)-n) if isqrt(t:=int(e[k:k+n]))**2 == t), "more digits needed")

%o print([a(n) for n in range(1, 11)]) # _Michael S. Branicky_, Dec 28 2022

%Y Cf. A001113.

%K nonn,base

%O 1,2

%A _Michel Lagneau_, Feb 20 2011

%E a(11)-a(20) from _Michael S. Branicky_, Dec 28 2022