login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Numbers that are congruent to {0, 1, 2} mod 6.
13

%I #72 Jan 23 2025 16:28:56

%S 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,

%T 49,50,54,55,56,60,61,62,66,67,68,72,73,74,78,79,80,84,85,86,90,91,92,

%U 96,97,98,102,103,104,108,109,110,114,115,116,120,121,122

%N Numbers that are congruent to {0, 1, 2} mod 6.

%C Partial sums of 0,1,1,4,1,1,4,... - _Paul Barry_, Feb 19 2007

%C Numbers k such that floor(k/3) = 2*floor(k/6). - _Bruno Berselli_, Oct 05 2017

%H Vincenzo Librandi, <a href="/A047240/b047240.txt">Table of n, a(n) for n = 1..10000</a>

%H Vladimir Pletser, <a href="http://arxiv.org/abs/1409.7969">Congruence conditions on the number of terms in sums of consecutive squared integers equal to squared integers</a>, arXiv:1409.7969 [math.NT], 2014.

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

%F From _Paul Barry_, Feb 19 2007: (Start)

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

%F a(n) = 2*n - 3 - cos(2*n*Pi/3) + sin(2*n*Pi/3)/sqrt(3). (End)

%F a(n) = n-1 + 3*floor((n-1)/3). - _Philippe Deléham_, Apr 21 2009

%F a(n) = 6*floor(n/3) + (n mod 3). - _Gary Detlefs_, Mar 09 2010

%F 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.

%F a(n) = 2*n - 2 - A010872(n-1). - _Wesley Ivan Hurt_, Jul 07 2013

%F From _Wesley Ivan Hurt_, Jun 14 2016: (Start)

%F a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.

%F a(3*k) = 6*k-4, a(3*k-1) = 6*k-5, a(3*k-2) = 6*k-6. (End)

%F Sum_{n>=2} (-1)^n/a(n) = (3-sqrt(3))*Pi/18 + log(2+sqrt(3))/(2*sqrt(3)). - _Amiram Eldar_, Dec 14 2021

%F 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

%p 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

%p select(k -> modp(iquo(k,3), 2) = 0, [$0..122]); # _Peter Luschny_, Oct 05 2017

%t Select[Range[0, 200], Mod[#, 6] == 0 || Mod[#, 6] == 1 || Mod[#, 6] == 2 &] (* _Vladimir Joseph Stephan Orlovsky_, Jul 07 2011 *)

%t a047240[n_] := Flatten[Map[6 # + {0, 1, 2} &, Range[0, n]]]; a047240[20] (* data *) (* _Hartmut F. W. Hoft_, Mar 06 2017 *)

%o (Magma) [0] cat [6*Floor(n/3) + (n mod 3): n in [1..65]]; // _Vincenzo Librandi_, Oct 23 2011

%o (PARI) a(n)=n\3*6 + n%3 \\ _Charles R Greathouse IV_, Oct 07 2015

%o (Python)

%o [k for k in range(123) if (k//3) % 2 == 0] # _Peter Luschny_, Oct 05 2017

%Y Cf. A010872, A030341, A047234, A047242.

%Y Cf. similar sequences with formula n+i*floor(n/3) listed in A281899.

%K nonn,easy,changed

%O 1,3

%A _N. J. A. Sloane_

%E Paul Barry formula adapted for offset 1 by _Wesley Ivan Hurt_, Jun 14 2016