OFFSET
1,2
LINKS
EXAMPLE
For n = 3, prime(n) = 5, so a(3) = (5-1)^3 + (5+1)^3 mod 5^2 = 280 mod 25 = 5.
MATHEMATICA
Table[p=Prime[n]; Mod[((p-1)^n+(p+1)^n), p^2], {n, 57}] (* James C. McMahon, Jan 07 2025 *)
PROG
(Python)
import sympy
def a(n):
nth_prime = sympy.prime(n)
nth_prime_sq = nth_prime**2
return (pow(nth_prime-1, n, nth_prime_sq) + pow(nth_prime+1, n, nth_prime_sq)) % (nth_prime_sq)
CROSSREFS
KEYWORD
nonn,new
AUTHOR
Do Thanh Nhan, Dec 24 2024
STATUS
approved