OFFSET
1,2
COMMENTS
Appears to be the sequence of n such that n never divides 3^x-2^x for x>=0. - Benoit Cloitre, Aug 19 2002
Numbers divisible by 2 or 3. - Nick Hobson, Mar 13 2007
Numbers k such that average of squares of the first k positive integers is not integer. A089128(a(n)) > 1. For n >= 2, a(n) = complement of A007310. - Jaroslav Krizek, May 28 2010
Numbers k such that k*Fibonacci(k) is even. - Gary Detlefs, Oct 27 2011
Also numbers that have a divisor d with 2^1 <= d < 2^2 (see Ei definition p. 340 in Besicovitch article). - Michel Marcus, Oct 31 2013
Starting with 0, 2, a(n) is the smallest number greater than a(n-1) that is not relatively prime to a(n-2). - Franklin T. Adams-Watters, Dec 04 2014
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..10000
A. S. Besicovitch, On the density of certain sequences of integers, Mathematische Annalen, Vol. 110, No. 1 (1935), pp. 336-341; alternative link.
Hsien-Kuei Hwang, Svante Janson and Tsung-Hsi Tsai, Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications, ACM Transactions on Algorithms, Vol. 13, No. 4 (2017), Article #47; ResearchGate link; preprint, 2016.
Index entries for linear recurrences with constant coefficients, signature (2,-2,2,-1)
FORMULA
a(n) = (6*(n-1) - (1+(-1)^n)*(-1)^(n*(1+(-1)^n)/4))/4; also a(n) = (6*(n-1) - (-i)^n - i^n)/4, where i is the imaginary unit. - Bruno Berselli, Nov 08 2010
G.f.: x^2*(2-x+2*x^2) / ( (x^2+1)*(x-1)^2 ). - R. J. Mathar, Oct 08 2011
a(n) = floor((6*n-5)/4) + floor((1/2)*cos((n+2)*Pi/2) + 1/2). - Gary Detlefs, Oct 28 2011 and corrected by Aleksey A. Solomein, Feb 08 2016
a(n) = a(n-1) + a(n-4) - a(n-5), n>4. - Gionata Neri, Apr 15 2015
a(n) = -a(2-n) for all n in Z. - Michael Somos, Oct 05 2015
a(n) = n + 2*floor((n-2)/4) + floor(f(n+2)/3), where f(n) = n mod 4. - Aleksey A. Solomein, Feb 08 2016
a(n) = (3*n - 3 - cos(n*Pi/2))/2. - Wesley Ivan Hurt, Oct 02 2017
Sum_{n>=2} (-1)^n/a(n) = log(3)/2 - log(2)/3. - Amiram Eldar, Dec 12 2021
MATHEMATICA
Select[Range[0, 100], MemberQ[{0, 2, 3, 4}, Mod[#, 6]]&] (* Harvey P. Dale, Aug 15 2011 *)
a[ n_] := With[ {m = n - 1}, {2, 3, 4, 0}[[Mod[m, 4, 1]]] + Quotient[ m, 4] 6]; (* Michael Somos, Oct 05 2015 *)
PROG
(Magma) [ n : n in [0..150] | n mod 6 in [0, 2, 3, 4]] ; // Vincenzo Librandi, Jun 01 2011
(PARI) a(n)=(n-1)\4*6+[4, 0, 2, 3][n%4+1] \\ Charles R Greathouse IV, Oct 28 2011
(Haskell)
a047229 n = a047229_list !! (n-1)
a047229_list = filter ((`notElem` [1, 5]) . (`mod` 6)) [0..]
-- Reinhard Zumkeller, Jun 30 2012
(Python)
def A047229(n): return 3*(n-1>>1&-2)+(4, 0, 2, 3)[n&3] # Chai Wah Wu, Nov 18 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved