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”).

A094403
a(1) = 1; a(n) = (sum of previous terms)^n mod n.
0
1, 1, 2, 0, 4, 4, 5, 1, 0, 4, 0, 4, 0, 4, 0, 0, 13, 1, 6, 0, 8, 20, 9, 9, 1, 23, 0, 8, 12, 10, 26, 0, 11, 17, 29, 1, 12, 20, 8, 16, 3, 1, 36, 0, 0, 18, 19, 1, 18, 26, 13, 9, 10, 0, 34, 32, 30, 34, 43, 1, 8, 36, 8, 0, 50, 60, 43, 21, 25, 1, 18, 0, 12, 70, 25, 45, 30, 40, 4, 16, 80, 72, 37, 1
OFFSET
1,3
EXAMPLE
a(4) = 0 because the previous terms 1, 1, 2 sum to 4 and 4^4 mod 4 is 0. a(5) = 4 because the previous terms 1, 1, 2, 0 sum to 4 and 4^5 mod 5 is 4.
MAPLE
L := [1]; s := 1; p := 2; while (nops(L) < 90) do; if 1>0 then; t := (s^p) mod p; L := [op(L), t]; s := s+t; p := p+1; fi; od; L;
MATHEMATICA
Module[{aa={1}, n=1}, Do[n=n+1; AppendTo[aa, PowerMod[Total[aa], n, n]], {90}]; aa] (* Harvey P. Dale, Apr 04 2013 *)
CROSSREFS
Sequence in context: A116578 A078050 A134271 * A244340 A363062 A316987
KEYWORD
nonn
AUTHOR
Chuck Seggelin (seqfan(AT)plastereddragon.com), Jun 03 2004
STATUS
approved