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.

Showing 1-4 of 4 results.

A197930 Numbers n such that the number of distinct residues in x^(n-1) (mod n), x=0..n-1, equals n.

Original entry on oeis.org

1, 2, 6, 10, 14, 22, 26, 30, 34, 38, 42, 46, 58, 62, 74, 78, 82, 86, 94, 102, 106, 110, 114, 118, 122, 134, 138, 142, 146, 158, 166, 170, 174, 178, 182, 194, 202, 206, 210, 214, 218, 222, 226, 230, 254, 258, 262, 266, 274, 278, 282, 290, 298, 302, 314, 318
Offset: 1

Views

Author

Michel Lagneau, Oct 19 2011

Keywords

Comments

a(n) = n if n = 2p, p prime > 2, or n = 2q with q nonprime such that q = 1, 15, 21, 39, 51, 55, 57, 69, 85, 87, 91,…

Examples

			a(8) = 30 because x^29  == 0,1,2, …,28,29  (mod 30) with 30 distinct residues.
		

Crossrefs

Programs

  • Mathematica
    lst={}; Table[If[Length[Union[PowerMod[Range[0,n-1],n-1,n]]]==n, AppendTo[lst,n]], {n,320}]; lst
    Select[Range[400],Length[Union[PowerMod[Range[0,#-1],#-1,#]]]==#&] (* Harvey P. Dale, Nov 06 2016 *)

Formula

n such that A197929(n) = n.

A198020 Number of distinct residues of x^n (mod 2n+1), x=0..2n.

Original entry on oeis.org

1, 3, 3, 3, 4, 3, 3, 15, 3, 3, 8, 3, 6, 19, 3, 3, 12, 35, 3, 39, 3, 3, 12, 3, 8, 51, 3, 55, 20, 3, 3, 49, 8, 3, 24, 3, 3, 63, 24, 3, 28, 3, 27, 87, 3, 15, 32, 95, 3, 77, 3, 3, 16, 3, 3, 111, 3, 115, 28, 119, 12, 123, 51, 3, 44, 3, 8, 95, 3, 3, 48, 143, 16, 129
Offset: 0

Views

Author

Michel Lagneau, Oct 20 2011

Keywords

Comments

a(n) = 3 if 2n+1 prime because the corresponding residues are 0, 1 and 2n (mod 2n+1).

Examples

			a(7) = 15 because x^7  == 0, 1, …,14  (mod 15) => 15 distinct residues.
		

Crossrefs

Programs

  • Mathematica
    Table[Length[Union[PowerMod[Range[0, 2*n], n, 2*n+1]]], {n,0, 100}]

A197943 Greatest residue of x^(n-1) (mod n), x=0..n-1.

Original entry on oeis.org

0, 1, 1, 3, 1, 5, 1, 7, 7, 9, 1, 11, 1, 13, 10, 15, 1, 17, 1, 19, 18, 21, 1, 23, 21, 25, 25, 27, 1, 29, 1, 31, 31, 33, 30, 35, 1, 37, 36, 39, 1, 41, 1, 43, 40, 45, 1, 47, 43, 49, 49, 51, 1, 53, 49, 55, 55, 57, 1, 59, 1, 61, 58, 63, 61, 65, 1, 67, 64, 69, 1, 71, 1, 73, 69, 75, 71, 77, 1, 79, 79, 81, 1, 83, 81, 85, 82, 87, 1, 89, 78
Offset: 1

Views

Author

Michel Lagneau, Oct 19 2011

Keywords

Comments

a(n) = 1 if n prime and a(n) = n-1 if n even.

Examples

			a(8) = 7 because x^7 == 0, 1, 3, 5, 7  (mod 8) => 7 is the greatest residue.
		

Crossrefs

Programs

  • Mathematica
    Table[Max[PowerMod[Range[0,n-1],n-1,n]], {n,100}]
  • PARI
    A197943(n) = { my(m=0); for(x=0,n-1, m = max(m,lift(Mod(x^(n-1),n)))); (m); }; \\ Antti Karttunen, Sep 10 2018

Extensions

More terms added, incorrect PARI-program removed by Antti Karttunen, Sep 10 2018

A216090 Numbers n such that k^(n-1) == k (mod n) for every k = 1, 2, ..., n-1.

Original entry on oeis.org

1, 2, 6, 10, 14, 22, 26, 30, 34, 38, 46, 58, 62, 74, 82, 86, 94, 106, 118, 122, 134, 142, 146, 158, 166, 178, 182, 194, 202, 206, 214, 218, 226, 254, 262, 274, 278, 298, 302, 314, 326, 334, 346, 358, 362, 382, 386, 394, 398, 422, 446, 454, 458, 466, 478, 482
Offset: 1

Views

Author

Michel Lagneau, Sep 01 2012

Keywords

Comments

Subsequence of, but different from A197930, for example A197930(11) = 42 with 42 distinct residues, but the set R of the residues k^41 mod 42 is R = {1, 32, 33, 16, 17, 6, …, 9, 10, 41} for k = 1, 2, …, 41 instead R = {1, 2, 3, …, 40, 41}. Terms of A197930 that are not in this sequence: 42, 78, 110, 114, 138, 170, …
Squarefree numbers n such that A002322(n) divides n-2. Contains all doubled odd primes and all doubled Carmichael numbers. - Thomas Ordowski, Apr 23 2017

Examples

			a(4) = 10 because x^9  == 1, 2, ..., 9  (mod 10) with 9 distinct residues such that:
1^9 = 1 == 1 (mod 10);
2^9 = 512 == 2 (mod 10);
3^9 = 19683 == 3 (mod 10);
4^9 = 262144 == 4 (mod 10);
5^9 = 1953125 == 5 (mod 10);
6^9 = 10077696 == 6 (mod 10);
7^9 = 40353607 == 7 (mod 10);
8^9 = 134217728 == 8 (mod 10);
9^9 = 387420489 == 9 (mod 10).
		

Crossrefs

Subsequence of A192109.
Terms > 2 form a subsequence of A050990.

Programs

  • Maple
    with(numtheory):for n from 1  to 500 do:j:=0:for i from 1 to n do: if irem(i^(n-1),n)=i then j:=j+1:else fi:od:if j=n-1 then printf(`%d, `, n):else fi:od:
  • Mathematica
    f[n_] := And @@ Table[PowerMod[k, n - 1, n] == k, {k, n - 1}]; Select[Range[500], f] (* T. D. Noe, Sep 03 2012 *)
  • PARI
    isok(n) = {for (k=1, n-1, if (Mod(k, n)^(n-1) != Mod(k, n), return (0));); return (1);} \\ Michel Marcus, Apr 23 2017
    
  • Python
    from sympy.ntheory.factor_ import core
    from sympy import primefactors
    def ok(n):
        if n<3: return True
        if core(n) == n:
            for p in primefactors(n):
                if (n - 2)%(p - 1): return False
            return True
        return False
    print([n for n in range(1, 501) if ok(n)]) # Indranil Ghosh, Apr 23 2017
Showing 1-4 of 4 results.