A047240 Numbers that are congruent to {0, 1, 2} mod 6.
0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, 24, 25, 26, 30, 31, 32, 36, 37, 38, 42, 43, 44, 48, 49, 50, 54, 55, 56, 60, 61, 62, 66, 67, 68, 72, 73, 74, 78, 79, 80, 84, 85, 86, 90, 91, 92, 96, 97, 98, 102, 103, 104, 108, 109, 110, 114, 115, 116, 120, 121, 122
Offset: 1
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).
Crossrefs
Programs
-
Magma
[0] cat [6*Floor(n/3) + (n mod 3): n in [1..65]]; // Vincenzo Librandi, Oct 23 2011
-
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 *)
-
PARI
a(n)=n\3*6 + n%3 \\ Charles R Greathouse IV, Oct 07 2015
-
Python
[k for k in range(123) if (k//3) % 2 == 0] # Peter Luschny, Oct 05 2017
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
Extensions
Paul Barry formula adapted for offset 1 by Wesley Ivan Hurt, Jun 14 2016
Comments