%I #23 Mar 01 2020 04:31:16
%S 1,3,10,31,98,307,965,3031,9523,29917,93988,295272,927625,2914219,
%T 9155290,28762191,90359088,283871447,891808453,2801698884,8801796632,
%U 27651659637,86870250776,272910941653,857375009382,2693523030845,8461952165978,26584006759664
%N Ratios of consecutive terms approach Pi alternating from below and above.
%C The alternation of ratios above and below is chosen to match the behavior of ratios of the Fibonacci numbers with respect to the golden ratio.
%H Eric M. Schmidt, <a href="/A214839/b214839.txt">Table of n, a(n) for n = 1..2000</a>
%e a(2) = 3 since 3/1 < Pi, while 4/1 > Pi. a(3) = 10 since 10/3 > Pi, while 9/3 < Pi.
%t PiApprox = Table[1, {i, 1, 40}]; For[i = 2, i < 41, i++, If[Mod[i, 2] == 0, PiApprox[[i]] = Floor[PiApprox[[i - 1]]*Pi], PiApprox[[i]] = Ceiling[PiApprox[[i - 1]]*Pi]]]
%o (Sage)
%o def A214839(numterms) :
%o res = [1]
%o for i in range(1, numterms) :
%o res.append(floor(pi*res[i-1]) if is_odd(i) else ceil(pi*res[i-1]))
%o return res
%o # _Eric M. Schmidt_, Mar 26 2013
%K easy,nonn
%O 1,2
%A _William J. Keith_, Mar 08 2013
|