A199923 a(n) = Sum_{k=0..3^(n-1)} gcd(k,3^(n-1)) for n > 0 and a(0) = 1.
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
Examples
a(3) = 9 + 1 + 1 + 3 + 1 + 1 + 3 + 1 + 1 + 9.
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (6,-9).
Programs
-
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
-
Mathematica
LinearRecurrence[{6,-9}, {1,2,8}, 41] (* 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
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)
Extensions
More terms from Sean A. Irvine, Jun 27 2022