OFFSET
1,5
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
EXAMPLE
a(4) = 1 because 3^4 = 81, 4^2 = 16 and 81 = 1 mod 80.
a(5) = 18 because 3^5 = 243, 5^2 = 25 and 243 = 18 mod 25.
MAPLE
a:= n-> 3&^n mod n^2:
seq(a(n), n=1..60); # Alois P. Heinz, Dec 22 2013
MATHEMATICA
Table[Mod[3^n, n^2], {n, 100}] (* Alonso del Arte, Dec 11 2013 *)
Table[PowerMod[3, n, n^2], {n, 100}] (* Harvey P. Dale, Aug 27 2019 *)
PROG
(Python)
for n in range(1, 100): print(str(3**n % n**2), end=', ')
(PARI) a(n) = lift(Mod(3, n^2)^n); \\ Michel Marcus, May 05 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alex Ratushnyak, Dec 11 2013
STATUS
approved