login
A233471
a(n) = 3^n mod n^2.
3
0, 1, 0, 1, 18, 9, 31, 33, 0, 49, 3, 81, 146, 177, 207, 65, 224, 81, 307, 1, 342, 9, 118, 225, 68, 529, 0, 753, 467, 549, 623, 641, 27, 757, 607, 81, 632, 389, 846, 801, 905, 981, 261, 81, 243, 1757, 1554, 2241, 2383, 249, 792, 1329, 851, 729, 1332, 2529, 1737, 2793, 298
OFFSET
1,5
LINKS
FORMULA
a(n) = A000244(n) mod A000290(n).
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