OFFSET
0,3
COMMENTS
Corresponding formulas for several first primes:
p=3, a(n)=(3*3^n+2*n+1)/4 (A047926)
p=5, a(n)=(5^n-4*n-1)/8 (A185055)
p=7, a(n)=(7^n-1)/6
p=11, a(n)=(3*11^n+10*n-3)/20
p=13, a(n)=(13^n-4*n-1)/8
p=17, a(n)=(17^n-1)/8
p=19, a(n)=(5*19^n+18*n-5)/36
p=23, a(n)=3*(23^n-1)/22
p=29, a(n)=(29^n-4*n-1)/8
p=31, a(n)=2*(31^n-1)/15
p=37, a(n)=(37^n-4*n-1)/8
p=41, a(n)=(41^n-1)/8
p=43, a(n)=(11*43^n+42*n-11)/84
p=47, a(n)=3*(47^n-1)/23.
General formulas for a(n) depend on p mod 8 as follows:
p = 1 mod 8, a(n)=(p^n-1)/8
p = 3 mod 8, a(n)=((p + 1)*p^n + 4*(p - 1)*n - (p + 1))/(8*(p - 1))
p = 5 mod 8, a(n)=(p^n-4*n-1)/8
p = 7 mod 8, a(n)=((p + 1)*(p^n - 1))/(8*(p - 1)).
LINKS
Index entries for linear recurrences with constant coefficients, signature (7,-11,5).
FORMULA
a(n) = (5^n-4n-1)/8.
From Chai Wah Wu, Jun 07 2024: (Start)
a(n) = 7*a(n-1) - 11*a(n-2) + 5*a(n-3) for n > 2.
G.f.: -2*x^2/((x - 1)^2*(5*x - 1)). (End)
a(n) = 2 * A014827(n-1) for n >= 2. - Alois P. Heinz, Jun 07 2024
EXAMPLE
a(2)=2 because 25^2 = 9^2+12^2+20^2 = 12^2+15^2+16^2.
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Zak Seidov, Mar 02 2012
STATUS
approved