login
A199923
a(n) = Sum_{k=0..3^(n-1)} gcd(k,3^(n-1)) for n > 0 and a(0) = 1.
6
1, 2, 8, 30, 108, 378, 1296, 4374, 14580, 48114, 157464, 511758, 1653372, 5314410, 17006112, 54206982, 172186884, 545258466, 1721868840, 5423886846, 17046501516, 53464027482, 167365651248, 523017660150, 1631815099668, 5083731656658, 15816054042936
OFFSET
0,2
FORMULA
a(n) = 2 * (n+2) * 3^(n-2), n > 0. - Sean A. Irvine, Jun 27 2022
From G. C. Greubel, Nov 24 2023: (Start)
a(n) = (2*(n+2)*3^n + 5*[n=0])/9.
G.f.: (1-4*x+5*x^2)/(1-3*x)^2. [corrected by Jason Yuen, Oct 24 2024]
E.g.f.: (1/9)*( 5 + 2*(2 + 3*x)*exp(3*x) ). (End)
EXAMPLE
a(3) = 9 + 1 + 1 + 3 + 1 + 1 + 3 + 1 + 1 + 9.
MATHEMATICA
LinearRecurrence[{6, -9}, {1, 2, 8}, 41] (* G. C. Greubel, Nov 24 2023 *)
PROG
(Magma) [1] cat [n le 2 select 2^(2*n-1) else 6*Self(n-1) -9*Self(n-2): n in [1..40]]; // G. C. Greubel, Nov 24 2023
(SageMath) [(2*(n+2)*3^n + 5*int(n==0))//9 for n in range(41)] # G. C. Greubel, Nov 24 2023
CROSSREFS
First differences of A086972.
Row sums of A199922.
Sequence in context: A365693 A168605 A127865 * A230269 A278023 A077839
KEYWORD
nonn,easy
AUTHOR
Peter Luschny, Nov 12 2011
EXTENSIONS
More terms from Sean A. Irvine, Jun 27 2022
STATUS
approved