login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A066601
a(n) = 3^n mod n.
14
0, 1, 0, 1, 3, 3, 3, 1, 0, 9, 3, 9, 3, 9, 12, 1, 3, 9, 3, 1, 6, 9, 3, 9, 18, 9, 0, 25, 3, 9, 3, 1, 27, 9, 12, 9, 3, 9, 27, 1, 3, 15, 3, 37, 18, 9, 3, 33, 31, 49, 27, 29, 3, 27, 12, 9, 27, 9, 3, 21, 3, 9, 27, 1, 48, 3, 3, 13, 27, 39, 3, 9, 3, 9, 57
OFFSET
1,5
LINKS
Harry J. Smith and Seiichi Manyama, Table of n, a(n) for n = 1..10000 (first 1000 terms from Harry J. Smith)
EXAMPLE
a(7) = 3 as 3^7 = 2187 = 7*312 + 3.
MAPLE
seq(irem(3^n, n), n=1..75); # Zerinvary Lajos, Apr 20 2008
MATHEMATICA
Table[PowerMod[3, n, n], {n, 75}]
PROG
(PARI) a(n) = { lift(Mod(3, n)^n) } \\ Harry J. Smith, Mar 09 2010
(Python)
def A066601(n): return pow(3, n, n) # Chai Wah Wu, Aug 24 2023
CROSSREFS
Cf. k^n mod n: A015910 (k=2), this sequence (k=3), A066602 (k=4), A066603 (k=5), A066604 (k=6), A066438 (k=7), A066439 (k=8), A066440 (k=9), A056969 (k=10), A066441 (k=11), A066442 (k=12), A116609 (k=13).
Sequence in context: A357073 A019801 A086634 * A110566 A126066 A177693
KEYWORD
base,easy,nonn,changed
AUTHOR
Amarnath Murthy, Dec 22 2001
EXTENSIONS
More terms from Robert G. Wilson v, Dec 27 2001
STATUS
approved