OFFSET
1,3
COMMENTS
Partial sums of 0,1,1,4,1,1,4,... - Paul Barry, Feb 19 2007
Numbers k such that floor(k/3) = 2*floor(k/6). - Bruno Berselli, Oct 05 2017
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..10000
Vladimir Pletser, Congruence conditions on the number of terms in sums of consecutive squared integers equal to squared integers, arXiv:1409.7969 [math.NT], 2014.
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
From Paul Barry, Feb 19 2007: (Start)
G.f.: x*(1 + x + 4*x^2)/((1 - x)*(1 - x^3)).
a(n) = 2*n - 3 - cos(2*n*Pi/3) + sin(2*n*Pi/3)/sqrt(3). (End)
a(n) = n-1 + 3*floor((n-1)/3). - Philippe Deléham, Apr 21 2009
a(n) = 6*floor(n/3) + (n mod 3). - Gary Detlefs, Mar 09 2010
a(n+1) = Sum_{k>=0} A030341(n,k)*b(k) with b(0)=1 and b(k)=2*3^k for k>0. - Philippe Deléham, Oct 22 2011.
a(n) = 2*n - 2 - A010872(n-1). - Wesley Ivan Hurt, Jul 07 2013
From Wesley Ivan Hurt, Jun 14 2016: (Start)
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
a(3*k) = 6*k-4, a(3*k-1) = 6*k-5, a(3*k-2) = 6*k-6. (End)
Sum_{n>=2} (-1)^n/a(n) = (3-sqrt(3))*Pi/18 + log(2+sqrt(3))/(2*sqrt(3)). - Amiram Eldar, Dec 14 2021
E.g.f.: 4 + exp(x)*(2*x - 3) - exp(-x/2)*(3*cos(sqrt(3)*x/2) - sqrt(3)*sin(sqrt(3)*x/2))/3. - Stefano Spezia, Jul 26 2024
MAPLE
A047240:=n->2*n-3-cos(2*n*Pi/3)+sin(2*n*Pi/3)/sqrt(3): seq(A047240(n), n=1..100); # Wesley Ivan Hurt, Jun 14 2016
select(k -> modp(iquo(k, 3), 2) = 0, [$0..122]); # Peter Luschny, Oct 05 2017
MATHEMATICA
Select[Range[0, 200], Mod[#, 6] == 0 || Mod[#, 6] == 1 || Mod[#, 6] == 2 &] (* Vladimir Joseph Stephan Orlovsky, Jul 07 2011 *)
a047240[n_] := Flatten[Map[6 # + {0, 1, 2} &, Range[0, n]]]; a047240[20] (* data *) (* Hartmut F. W. Hoft, Mar 06 2017 *)
PROG
(Magma) [0], [6*Floor(n/3) + (n mod 3): n in [1..65]]; // Vincenzo Librandi, Oct 23 2011
(PARI) a(n)=n\3*6 + n%3 \\ Charles R Greathouse IV, Oct 07 2015
(Python 3)
[k for k in range(123) if (k//3) % 2 == 0] # Peter Luschny, Oct 05 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
Paul Barry formula adapted for offset 1 by Wesley Ivan Hurt, Jun 14 2016
STATUS
approved