login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A318609 a(1) = 2, a(2) = 4, a(3) = 6; for n > 3, a(n) = 3*a(n-1) - 3*a(n-2) + 9*a(n-3). 12

%I #41 Sep 08 2022 08:46:22

%S 2,4,6,24,90,252,702,2160,6642,19764,58806,176904,532170,1595052,

%T 4780782,14346720,43053282,129146724,387400806,1162241784,3486843450,

%U 10460412252,31380882462,94143001680,282430067922,847289140884,2541864234006,7625595890664,22876797237930

%N a(1) = 2, a(2) = 4, a(3) = 6; for n > 3, a(n) = 3*a(n-1) - 3*a(n-2) + 9*a(n-3).

%C a(n) is the number of solutions to Sum_{i=1..n} x_i^2 == 1 (mod 3).

%H Jianing Song, <a href="/A318609/b318609.txt">Table of n, a(n) for n = 1..500</a>

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

%F a(n) = middle term in M^n * [1, 0, 0]^T, where M = the 3 X 3 matrix [1, 0, 2 / 2, 1, 0 / 0, 2, 1]] and T denotes transpose. [Edited by _Petros Hadjicostas_, Dec 19 2019]

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

%F E.g.f.: 1/3*(exp(3*x) + 2*cos(sqrt(3)*x - 2*Pi/3)).

%F a(n) = 3^(n/2 - 1)*((-i)^n*(-1 + sqrt(3)*i)/2 + i^n*(-1 - sqrt(3)*i)/2 + 3^(n/2)), where i is the imaginary unit.

%F a(n) = 3^(n/2 - 1)*(2*cos(n*Pi/2 - 2*Pi/3) + 3^(n/2)).

%F a(n) = 3^(n-1) + (-3)^(n/2-1) for even n and 3^(n-1) + (-3)^((n-1)/2) for odd n.

%F a(n) = a(n-1) + 2*A101990(n-1).

%F a(n) = A318610(n) for even n and 2*3^(n-1) - A318610(n) for odd n.

%F a(n) + A101990(n) + A318610(n) = 3^n.

%e a(5) = 90 since M^5 * [1, 0, 0]^T = [81, 90, 72]^T.

%t LinearRecurrence[{3, -3, 9}, {2, 4, 6}, 30] (* _Jianing Song_, Sep 05 2018 *)

%o (PARI) Vec(2*x*(1-x)/((1-3*x)*(1+3*x^2)) + O(x^40))

%o (PARI) a(n) = ([1, 0, 2 ; 2, 1, 0 ; 0, 2, 1]^n*mattranspose([1, 0, 0]))[2]; \\ _Michel Marcus_, Dec 20 2019

%o (Magma) I:=[2,4,6]; [n le 3 select I[n] else 3*Self(n-1)-3*Self(n-2)+9*Self(n-3): n in [1..30]]; // _Jianing Song_, Sep 05 2018

%Y A101990 gives the number of solutions to Sum_{i=1..n} x_i^2 == 0 (mod 3);

%Y A318610 gives the number of solutions to Sum_{i=1..n} x_i^2 == 2 (mod 3).

%Y Cf. A228921, A228920, A229138, A330607, A330619, A330635.

%K nonn,easy

%O 1,1

%A _Jianing Song_, Sep 02 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 00:26 EDT 2024. Contains 371264 sequences. (Running on oeis4.)