This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A318610 #41 Sep 08 2022 08:46:22 %S A318610 0,4,12,24,72,252,756,2160,6480,19764,59292,176904,530712,1595052, %T A318610 4785156,14346720,43040160,129146724,387440172,1162241784,3486725352, %U A318610 10460412252,31381236756,94143001680,282429005040,847289140884,2541867422652,7625595890664,22876787671992 %N A318610 a(1) = 0, a(2) = 4, a(3) = 12; for n > 3, a(n) = 3*a(n-1) - 3*a(n-2) + 9*a(n-3). %C A318610 a(n) is the number of solutions to Sum_{i=1..n} x_i^2 == 2 (mod 3). %H A318610 Jianing Song, <a href="/A318610/b318610.txt">Table of n, a(n) for n = 1..500</a> %H A318610 <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,-3,9). %F A318610 a(n) = last 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 A318610 O.g.f.: 4*x^2/((1 - 3x)*(1 + 3*x^2)). %F A318610 E.g.f.: 1/3*(exp(3*x) + 2*cos(sqrt(3)*x + 2*Pi/3)). %F A318610 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 A318610 a(n) = 3^(n/2 - 1)*(2*cos(n*Pi/2 + 2*Pi/3) + 3^(n/2)). %F A318610 a(n) = 3^(n-1) + (-3)^(n/2-1) for even n and 3^(n-1) - (-3)^((n-1)/2) for odd n. %F A318610 a(n) = a(n-1) + 2*A318609(n-1). %F A318610 a(n) = A318609(n) for even n and 2*3^(n-1) - A318609(n) for odd n. %F A318610 a(n) + A101990(n) + A318609(n) = 3^n. %e A318610 a(5) = 72 since M^5 * [1, 0, 0]^T = [81, 90, 72]^T. %t A318610 LinearRecurrence[{3, -3, 9}, {0, 4, 12}, 30] (* _Vincenzo Librandi_, Sep 04 2018 *) %o A318610 (PARI) concat([0], Vec(4*x^2/((1-3*x)*(1+3*x^2)) + O(x^40))) %o A318610 (PARI) a(n) = ([1, 0, 2 ; 2, 1, 0 ; 0, 2, 1]^n*mattranspose([1, 0, 0]))[3]; \\ _Michel Marcus_, Dec 20 2019 %o A318610 (Magma) I:=[0,4,12]; [n le 3 select I[n] else 3*Self(n-1)-3*Self(n-2)+9*Self(n-3): n in [1..30]]; // _Vincenzo Librandi_, Sep 04 2018 %Y A318610 A101990 gives the number of solutions to Sum_{i=1..n} x_i^2 == 0 (mod 3); %Y A318610 A318609 gives the number of solutions to Sum_{i=1..n} x_i^2 == 1 (mod 3). %Y A318610 Cf. A228921, A228920, A229138, A330607, A330619, A330635. %K A318610 nonn,easy %O A318610 1,2 %A A318610 _Jianing Song_, Sep 02 2018