login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

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 60th year, we have over 367,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A195637 Number of distinct residues of k^n (mod n), k=0..n-1. 23
1, 2, 3, 2, 5, 4, 7, 2, 3, 6, 11, 4, 13, 8, 15, 2, 17, 4, 19, 4, 9, 12, 23, 4, 5, 14, 3, 8, 29, 12, 31, 2, 33, 18, 35, 4, 37, 20, 15, 4, 41, 8, 43, 12, 15, 24, 47, 4, 7, 6, 51, 8, 53, 4, 15, 8, 21, 30, 59, 8, 61, 32, 9, 2, 65, 24, 67, 10, 69, 24, 71, 4, 73 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
a(n) = n if n prime.
LINKS
EXAMPLE
a(18) = 4 because k^18 == 0, 1, 9, 10 (mod 18) => 4 distinct residues.
From R. J. Mathar, Aug 27 2013: (Start)
The triangle of k^n (mod n) starts in row n=1 with columns k>=0 as:
0;
0, 1;
0, 1, 2;
0, 1, 0, 1;
0, 1, 2, 3, 4;
0, 1, 4, 3, 4, 1;
0, 1, 2, 3, 4, 5, 6;
0, 1, 0, 1, 0, 1, 0, 1;
0, 1, 8, 0, 1, 8, 0, 1, 8;
0, 1, 4, 9, 6, 5, 6, 9, 4, 1;
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
0, 1, 4, 9, 4, 1, 0, 1, 4, 9, 4, 1;
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12;
Its row sums are 0, 1, 3, 2, 10, 13, 21, 4, 27, 45, 55, 38, 78, 77, 105, 8,.... (End)
MAPLE
a:= n-> nops({seq(k&^n mod n, k=0..n-1)}):
seq(a(n), n=1..100);
MATHEMATICA
Table[Length[Union[PowerMod[Range[0, n - 1], n, n]]], {n, 100}] (* T. D. Noe, Sep 21 2011 *)
PROG
(PARI) a(n)=if(isprime(n), n, #Set(vector(n, i, lift(Mod(i-1, n)^n)))) \\ Charles R Greathouse IV, Jul 31 2016
(Python)
def A195637(n): return len({pow(x, n, n) for x in range(n)}) # Chai Wah Wu, Aug 22 2023
CROSSREFS
Sequence in context: A238729 A182816 A367580 * A181861 A365099 A342694
KEYWORD
nonn,nice
AUTHOR
Michel Lagneau, Sep 21 2011
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 5 10:28 EST 2023. Contains 367589 sequences. (Running on oeis4.)