login

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

Numbers that are congruent to {1, 2, 3, 5} mod 6.
9

%I #61 Feb 21 2023 14:16:22

%S 1,2,3,5,7,8,9,11,13,14,15,17,19,20,21,23,25,26,27,29,31,32,33,35,37,

%T 38,39,41,43,44,45,47,49,50,51,53,55,56,57,59,61,62,63,65,67,68,69,71,

%U 73,74,75,77,79,80,81,83,85,86,87,89,91,92,93,95,97,98,99,101,103,104

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

%C Each element is coprime to preceding two elements. - _Amarnath Murthy_, Jun 12 2001

%C The sequence is the interleaving of A047241 with A016789. - _Guenther Schrack_, Feb 16 2019

%H Guenther Schrack, <a href="/A047255/b047255.txt">Table of n, a(n) for n = 1..10012</a>

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

%F {k | k == 1, 2, 3, 5 (mod 6)}.

%F G.f.: x*(1 + x^2 + x^3) / ((1+x^2)*(1-x)^2). - _R. J. Mathar_, Oct 08 2011

%F From _Wesley Ivan Hurt_, May 20 2016: (Start)

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

%F a(n) = (6*n - 4 + i^(1-n) + i^(n-1))/4, where i = sqrt(-1).

%F a(2*n) = A016789(n-1) for n>0, a(2*n-1) = A047241(n). (End)

%F E.g.f.: (2 + sin(x) + (3*x - 2)*exp(x))/2. - _Ilya Gutkovskiy_, May 21 2016

%F a(1-n) = - A047251(n). - _Wesley Ivan Hurt_, May 21 2016

%F From _Guenther Schrack_, Feb 16 2019: (Start)

%F a(n) = (6*n - 4 + (1 - (-1)^n)*(-1)^(n*(n-1)/2))/4.

%F a(n) = a(n-4) + 6, a(1)=1, a(2)=2, a(3)=3, a(4)=5, for n > 4.

%F a(n) = A047237(n) + 1. (End)

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

%F a(n) = 2*n - 1 - floor(n/2) + floor(n/4) - floor((n+1)/4). - _Ridouane Oudra_, Feb 21 2023

%e After 21 and 23 the next term is 25 as 24 has a common divisor with 21.

%p A047255:=n->(6*n-4+I^(1-n)+I^(n-1))/4: seq(A047255(n), n=1..100); # _Wesley Ivan Hurt_, May 20 2016

%t Select[Range[100], MemberQ[{1, 2, 3, 5}, Mod[#, 6]] &]

%t LinearRecurrence[{2,-2,2,-1},{1,2,3,5},100] (* _Harvey P. Dale_, May 14 2020 *)

%o (Haskell)

%o a047255 n = a047255_list !! (n-1)

%o a047255_list = 1 : 2 : 3 : 5 : map (+ 6) a047255_list

%o -- _Reinhard Zumkeller_, Jan 17 2014

%o (Magma) [n : n in [0..100] | n mod 6 in [1, 2, 3, 5]]; // _Wesley Ivan Hurt_, May 21 2016

%o (PARI) a(n)=([0,1,0,0; 0,0,1,0; 0,0,0,1; -1,2,-2,2]^(n-1)*[1;2;3;5])[1,1] \\ _Charles R Greathouse IV_, Feb 11 2017

%o (Sage) a=(x*(1+x^2+x^3)/((1+x^2)*(1-x)^2)).series(x, 80).coefficients(x, sparse=False); a[1:] # _G. C. Greubel_, Feb 16 2019

%Y Cf. A007310, A016789, A047228, A047237, A047241, A047251, A047261, A047273, A062062, A062063.

%Y Complement: A047233

%K nonn,nice,easy

%O 1,2

%A _N. J. A. Sloane_

%E More terms from Larry Reeves (larryr(AT)acm.org), Jun 15 2001