login
a(0) = a(1) = 1; thereafter a(2*n+1) = 2*a(2*n) - a(2*n-1), a(2*n) = 4*a(2*n-1) - a(2*n-2).
12

%I #106 Nov 26 2023 08:39:58

%S 1,1,3,5,17,29,99,169,577,985,3363,5741,19601,33461,114243,195025,

%T 665857,1136689,3880899,6625109,22619537,38613965,131836323,225058681,

%U 768398401,1311738121,4478554083,7645370045,26102926097,44560482149

%N a(0) = a(1) = 1; thereafter a(2*n+1) = 2*a(2*n) - a(2*n-1), a(2*n) = 4*a(2*n-1) - a(2*n-2).

%C a(1)=1, a(n) is the smallest integer > a(n-1) such that sqrt(2)*a(n) is closer and > to an integer than sqrt(2)*a(n-1) (i.e., a(n) is the smallest integer > a(n-1) such that frac(sqrt(2)*a(n)) < frac(sqrt(2)*a(n-1)).

%C a(n)*a(n+3) - a(n+1)*a(n+2) = 2. - _Paul D. Hanna_, Feb 22 2003

%C n such that floor(sqrt(2)*n^2) = n*floor(sqrt(2)*n).

%C The sequence 1,1,3,5,17,... has g.f. (1+x-3x^2-x^3)/(1-6x^2+x^4); a(n) = Sum_{k=0..floor(n/2)} C(n,2k)*2^(n-k-floor((n+1)/2)); a(n) = -(sqrt(2)-1)^n*((sqrt(2)/8-1/4)*(-1)^n - sqrt(2)/8 - 1/4) - (sqrt(2)+1)^n*((sqrt(2)/8-1/4)*(-1)^n - sqrt(2)/8 - 1/4); a(2n) = A001541(n) = A001333(2n); a(2n+1) = A001653(n) = A000129(2n+1). - _Paul Barry_, Jan 22 2005

%C The lower principal and intermediate convergents to 2^(1/2), beginning with 1/1, 4/3, 7/5, 24/17, 41/29, form a strictly increasing sequence; essentially, numerators=A143608 and denominators=A079496. - _Clark Kimberling_, Aug 27 2008

%C From _Richard Choulet_, May 09 2010: (Start)

%C This sequence is a particular case of the following situation: a(0)=1, a(1)=a, a(2)=b

%C with the recurrence relation a(n+3)=(a(n+2)*a(n+1)+q)/a(n) where q is given in Z to have Q=(a*b^2+q*b+a+q)/(a*b) itself in Z.

%C The g.f is f: f(z)=(1+a*z+(b-Q)*z^2+(a*b+q-a*Q)*z^3)/(1-Q*z^2+z^4); so we have the linear recurrence: a(n+4)=Q*a(n+2)-a(n).

%C The general form of a(n) is given by:

%C a(2*m)=sum((-1)^p*binomial(m-p,p)*Q^(m-2*p),p=0..floor(m/2))+(b-Q)*sum((-1)^p*binomial(m-1-p,p)*Q^(m-1-2*p),p=0..floor((m-1)/2)) and

%C a(2*m+1)=a*sum((-1)^p*binomial(m-p,p)*Q^(m-2*p),p=0..floor(m/2))+(a*b+q-a*Q)*sum((-1)^p*binomial(m-1-p,p)*Q^(m-1-2*p),p=0..floor((m-1)/2))

%C (End)

%C The integer square roots of floor(n^2/2 + 1) or (A007590 + 1). - _Richard R. Forberg_, Aug 01 2013

%D Serge Lang, Introduction to Diophantine Approximations, Addison-Wesley, New York, 1966.

%H Indranil Ghosh, <a href="/A079496/b079496.txt">Table of n, a(n) for n = 0..2608</a>

%H John M. Campbell, <a href="http://arxiv.org/abs/1105.3399">An Integral Representation of Kekulé Numbers, and Double Integrals Related to Smarandache Sequences</a>, arXiv:1105.3399 [math.GM], 2011.

%H Clark Kimberling, <a href="http://dx.doi.org/10.1007/s000170050020">Best lower and upper approximates to irrational numbers</a>, Elemente der Mathematik, 52 (1997) 122-126.

%H Yujun Yang, Heping Zhang, <a href="http://dx.doi.org/10.1002/qua.21537">Kirchhoff Index of linear hexagonal chains</a>, Int. J. Quant. Chem. 108 (2008) 503-512, eq (3.3).

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,6,0,-1).

%F a(2n+1) - a(2n) = a(2n) - a(2n-1) = A001542(n).

%F a(2n+1) = ceiling((2+sqrt(2))/4*(3+2*sqrt(2))^n), a(2n) = ceiling(1/2*(3+2*sqrt(2))^n).

%F G.f.: (1 + x - 3*x^2 - x^3)/(1 - 6*x^2 + x^4).

%F a(n) = 6*a(n-2) - a(n-4). - _R. J. Mathar_, Apr 04 2008

%F a(-n) = a(n) = A010914(n-3)*2^floor((4 - n)/2). - _Michael Somos_, Sep 03 2013

%F a(n) = (sqrt(2)*sqrt(2+(3-2*sqrt(2))^n+(3+2*sqrt(2))^n))/(2+sqrt(2)+(-1)^n*(-2+sqrt(2))). - _Gerry Martens_, Jun 06 2015

%F a(n) = 2^(n - 1)*H(n, n mod 2, 1/2) for n >= 3 where H(n, a, b) = hypergeom([a - n/2, b - n/2], [1 - n], -1). - _Peter Luschny_, Sep 03 2019

%F a(n) == Pell(n)^(-1) (mod Pell(n+1)) where Pell(n) = A000129(n), use the identity a(n)*Pell(n) - A084068(n-1)*Pell(n+1) = 1, taken modulo Pell(n+1). - _Gary W. Adamson_, Nov 21 2023

%e 1 + x + 3*x^2 + 5*x^3 + 17*x^4 + 29*x^5 + 99*x^6 + 169*x^7 + 577*x^8 + ...

%p H := (n, a, b) -> hypergeom([a - n/2, b - n/2], [1 - n], -1):

%p a := n -> `if`(n < 3, [1, 1, 3][n+1], 2^(n - 1)*H(n, irem(n, 2), 1/2)):

%p seq(simplify(a(n)), n=0..26); # _Peter Luschny_, Sep 03 2019

%t a[1] = 1; a[2] = 3; a[3] = 5; a[n_] := a[n] = (a[n-1]*a[n-2] + 2) / a[n-3]; Table[a[n], {n, 1, 29}] (* _Jean-François Alcover_, Jul 17 2013, after _Paul D. Hanna_ *)

%o (PARI) {a(n) = n = abs(n); 2^((4-n)\2) * real( (10 + 7 * quadgen(8)) / 2 * (2 + quadgen(8))^(n-3) ) } /* _Michael Somos_, Sep 03 2013 */

%o (PARI) {a(n) = polcoeff( (1 + x - 3*x^2 - x^3) / (1 - 6*x^2 + x^4) + x * O(x^abs(n)), abs(n))} /* _Michael Somos_, Sep 03 2013 */

%Y Cf. A010914, A058580.

%Y Cf. A000129, A084068.

%K nonn,easy

%O 0,3

%A _Benoit Cloitre_, Jan 20 2003

%E a(0)=1 added by _Michael Somos_, Sep 03 2013