OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..995
Eric Weisstein's World of Mathematics, Pythagoras's Constant.
FORMULA
a(n) = floor(sqrt(2)*10^(n*(n + 1)/2 - 1)) mod (10^n).
EXAMPLE
a(2) = 41 because the second and third digits of sqrt(2) are 4 and 1.
MATHEMATICA
Table[Mod[Floor[Sqrt[2] 10^(n ((n + 1)/2) - 1)], 10^n], {n, 1, 20}]
Table[Floor[10^(-1 + (n (1 + n))/2) Sqrt[2]] + Ceiling[-(Floor[10^(-1 + (n (1 + n))/2) Sqrt[2]]/10^n)] 10^n, {n, 1, 20}]
With[{x=20}, FromDigits/@TakeList[RealDigits[Sqrt[2], 10, (x(x+1))/2] [[1]], Range[x]]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 04 2019 *)
PROG
(Magma) [Floor(Sqrt(2)*10^(n*(n + 1)/2 - 1)) mod (10^n): n in [1..30]]; // Vincenzo Librandi, Feb 15 2016
(PARI) a(n) = lift(Mod(floor(sqrt(2)*10^(n*(n + 1)/2 - 1)), 10^n)); \\ G. C. Greubel, Oct 07 2018
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Ilya Gutkovskiy, Jan 13 2016
STATUS
approved