OFFSET
0,3
COMMENTS
For n > 3, a(n) can be a prime number only if n can be divided by 6. If n cannot be divided by 6 then a(n) has at least one divisors of the set {2, 3}.
a(c^n) for some constant c can be expressed as a linear recurrence with constant coefficients.
FORMULA
a(n) = -3*((n+1) Mod 2) + Sum_{k=1..n} ((k*(k+1)/2) Mod n)*6/n, for n > 0.
a(2^n) = A068156(n).
a(3^n) has the ordinary generating function: x*(-6*x - 2)/(9*x^4 - 12*x^3 + 4*x - 1).
a(5^n) has the ordinary generating function: x*(-18*x - 6)/(25*x^4 - 30*x^3 + 6*x - 1).
a(6^n) has the ordinary generating function: x*(9*x^2 - 18*x - 11)/(18*x^4 - 21*x^3 - 3*x^2 + 7*x - 1).
a(n) = n^2 - A374981(n)*6 - 1.
PROG
(PARI) a(n) = if(n==0, 0, sum(k=1, n, (k*(k+1)/2)%n)*6/n-3*((n+1)%2))
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Thomas Scheuerle, Jul 26 2024
STATUS
approved