cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A195743 Number of distinct residues of prime(k)^n (mod n), prime(k) <= n.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 4, 2, 3, 3, 5, 3, 6, 5, 6, 2, 7, 3, 8, 3, 5, 6, 9, 3, 5, 7, 3, 5, 10, 5, 11, 2, 11, 8, 11, 3, 12, 11, 8, 3, 13, 4, 14, 7, 10, 11, 15, 3, 7, 4, 15, 5, 16, 3, 9, 5, 11, 13, 17, 4, 18, 16, 6, 2, 18, 8, 19, 6, 19, 9, 20, 3, 21, 17, 10, 11, 21, 5
Offset: 1

Views

Author

Michel Lagneau, Sep 23 2011

Keywords

Comments

If n = prime(k), then a(n) = k.

Examples

			a(11) = a(prime(5)) = 5, and we check:  2^11, 3^11, 5^11, 7^11, 11^11 == 2, 3, 5, 7, 0 (mod 11) respectively => 5 distinct residues;
a(18) = 3 because 2^18, 3^18, 5^18, 7^18, 11^18, 13^18, 17^18 == 10, 9, 1, 1, 1, 1, 1 (mod 18) respectively => 3 distinct residues.
		

Crossrefs

Cf. A195637.

Programs

  • Maple
    a:= proc(n) local p, s; s:= {}; p:=2; while p<=n do s:= s union {p&^n mod n}; p:= nextprime(p) od; nops(s) end: seq(a(n), n=1..100);
  • Mathematica
    a[n_] := PowerMod[#, n, n]& /@ Prime[Range[PrimePi[n]]] // Union // Length;
    Array[a, 100] (* Jean-François Alcover, Nov 20 2020 *)
  • PARI
    a(n) = #Set(vector(primepi(n), k, Mod(prime(k), n)^n)); \\ Michel Marcus, Nov 20 2020