login
a(n) = ((3^(n-1) + 1)^3 -1)/3^n.
16

%I #43 May 13 2023 05:49:55

%S 7,37,271,2269,19927,177877,1596511,14355469,129159847,1162320517,

%T 10460530351,94143710269,847290203767,7625602267957,68630391713791,

%U 617673439330669,5559060695695687,50031545486420197,450283907053258831,4052555156505760669,36472996387631139607

%N a(n) = ((3^(n-1) + 1)^3 -1)/3^n.

%C This sequence is generalizable :

%C Proposition: p^n divide (p^(n-1) + 1)^ p - 1.

%C Proof: Let a and p be two integers such that p>=2, and k = gcd(a, p). Then ak divides (a + 1)^p - 1 because (a+1)^p - 1 = [a^p + binomial(p,1)*a^(p-1) + … + binomial(p,p-2)*a^2] + pa == binomial(p,1)*n^(n-1) == 0 (mod p^n) with a = p^(n-1) and k = p.

%C a(n) is the least k such that k*3^n+1 is a cube. Thus, the cube is given by (3^(n-1)+1)^3. - _Derek Orr_, Mar 23 2014

%H Vincenzo Librandi, <a href="/A198410/b198410.txt">Table of n, a(n) for n = 2..200</a>

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

%F G.f.: -x^2*(7-54*x+63*x^2) / ( (x-1)*(3*x-1)*(9*x-1) ). - _R. J. Mathar_, Oct 25 2011

%F a(n) = 13*a(n-1)-39*a(n-2)+27*a(n-3) for n>2. - _Vincenzo Librandi_, Mar 25 2014

%e a(2) = ((3 + 1)^3 - 1)/3^2 = 63/9 = 7.

%p A198410 := proc(n)

%p (3^(n-1)+1)^3 ;

%p (%-1)/3^n ;

%p end proc:

%p seq(A198410(n), n=2..20) ; # _R. J. Mathar_, Oct 25 2011

%t Table[((3^(n - 1) + 1)^3 - 1)/3^n, {n, 2, 20}] (* _Wesley Ivan Hurt_, Mar 24 2014 *)

%t CoefficientList[Series[(7 - 54 x + 63 x^2)/((1 - x) (3 x - 1) (9 x - 1)), {x, 0, 40}], x] (* _Vincenzo Librandi_, Mar 25 2014 *)

%t LinearRecurrence[{13,-39,27},{7,37,271},30] (* _Harvey P. Dale_, Mar 04 2015 *)

%o (Magma) I:=[7,37,271]; [n le 3 select I[n] else 13*Self(n-1)-39*Self(n-2)+27*Self(n-3): n in [1..30]]; // _Vincenzo Librandi_, Mar 25 2014

%o (PARI) a(n)=9^n/27+3^n/3+1 \\ _Charles R Greathouse IV_, Jun 11 2015

%Y Cf. A060073.

%K nonn,easy

%O 2,1

%A _Michel Lagneau_, Oct 24 2011