OFFSET
1,2
COMMENTS
Suppose you forget the first a(n) digits of Pi after the 3, but remember the rest - these values are the record-setting best approximations to Pi.
a(28) > 4.9*10^9. - Robert G. Wilson v, Apr 03 2015
EXAMPLE
a(1) = 1, giving an approximation 3.4159...
a(2) = 2, because 3.1592... is closer to Pi than 3.4159...
a(3) = 102, because 3.14808... is closer to Pi than any value obtained by removing fewer than 102 of the first decimal digits of Pi.
a(27) = 678096433, because 3.141592653607137185825... is closer to Pi than any value obtained by removing fewer than 678096433 of the first decimal digits of Pi. - Robert G. Wilson v, Apr 04 2015
MATHEMATICA
pi = N[Pi - 3, 1000000]; k = 1; d = Infinity; lst = {}; While[k < 990000, pi = 10 pi - IntegerPart[10 pi]; If[ Abs[Pi - 3 - pi] < d, d = Abs[Pi - 3 - pi]; AppendTo[lst, k]; Print[k]]; k++]; lst (* Robert G. Wilson v, Apr 01 2015 *)
PROG
(Python)
def a256516():
....best = 1
....yield 1
....i = 2
....while True:
........if i>=len(pi):
............return
........a = pi[i]
........valid = True
........o = 1
........while valid:
............pi_approx = int(pi[:o])
............a_approx = abs(int(pi[i:i+o])-pi_approx)
............b_approx = abs(int(pi[best:best+o])-pi_approx)
............if abs(b_approx-a_approx)>10:
................valid = False
............else:
................o+=1
........if a_approx<b_approx:
............best = i
............yield i
........i+=1
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Christian Perfect, Apr 01 2015
EXTENSIONS
a(10)-a(13) from Robert G. Wilson v, Apr 01 2015
a(14)-a(19) from Robert G. Wilson v, Apr 02 2015
a(20)-a(27) from Robert G. Wilson v, Apr 03 2015
STATUS
approved