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-2 of 2 results.

A216822 Numbers n such that 2^n == 2 (mod n*(n+1)).

Original entry on oeis.org

1, 5, 13, 29, 37, 61, 73, 157, 181, 193, 277, 313, 397, 421, 457, 541, 561, 613, 661, 673, 733, 757, 877, 997, 1093, 1153, 1201, 1213, 1237, 1289, 1321, 1381, 1453, 1621, 1657, 1753, 1873, 1905, 1933, 1993, 2017, 2137, 2341, 2473, 2557, 2593, 2797, 2857, 2917
Offset: 1

Views

Author

V. Raman, Sep 17 2012

Keywords

Comments

a(17) = 561 is the first composite number in the sequence. - Charles R Greathouse IV, Sep 19 2012
Intersection of { A015919(n) } and { A192109(n)-1 }. - Max Alekseyev, Apr 22 2013

Crossrefs

Cf. A069051 (prime n such that 2^n == 2 (mod n*(n-1))).
Cf. A217466 (prime terms of the sequence).
Cf. A217465 (composite terms of the sequence)

Programs

  • Mathematica
    Select[Range[1, 10000], Mod[2^# - 2, # (# + 1)] == 0 &] (* T. D. Noe, Sep 19 2012 *)
    Join[{1},Select[Range[3000],PowerMod[2,#,#(#+1)]==2&]] (* Harvey P. Dale, Oct 05 2022 *)
  • PARI
    is(n)=Mod(2,n*(n+1))^n==2; \\ Charles R Greathouse IV, Sep 19 2012
    
  • Python
    A216822_list = [n for n in range(1,10**6) if n == 1 or pow(2,n,n*(n+1)) == 2] # Chai Wah Wu, Mar 25 2021

Extensions

a(1)=1 prepended by Max Alekseyev, Dec 29 2017

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-2 of 2 results.