login
Positions of 7's in the decimal expansion of sqrt(2).
2

%I #16 Dec 26 2021 06:13:33

%S 12,26,36,42,45,48,54,57,60,62,64,68,72,79,88,94,99,101,118,134,136,

%T 148,169,176,179,191,198,201,210,216,219,233,238,269,281,289,298,304,

%U 344,347,352,353,359,366,373,379,387,400,411,430,431,442,465,479,496

%N Positions of 7's in the decimal expansion of sqrt(2).

%H G. C. Greubel, <a href="/A054303/b054303.txt">Table of n, a(n) for n = 1..10000</a>

%t Flatten[Position[RealDigits[Sqrt[2], 10, 500][[1]], 7]] (* _G. C. Greubel_, Jul 23 2019 *)

%o (Python)

%o from sympy import N, sqrt

%o def aupton(terms, precision=10000):

%o idx, alst = -1, []

%o root2_digits = str(N(sqrt(2), precision+2)).replace(".", "")[:-2]

%o for i in range(terms):

%o idx = root2_digits.find("7", idx+1)

%o if idx != -1: alst.append(idx+1)

%o else: print("Increase precision: got to", i); break

%o return alst

%o print(aupton(55)) # _Michael S. Branicky_, Dec 26 2021

%Y Cf. A002193.

%Y Cf. A054296, A054297, A054298, A054299, A054300, A054301, A054302 (0..6).

%Y Cf. A054304, A054305 (8..9).

%K nonn,base

%O 1,1

%A _Simon Plouffe_, Feb 20 2000