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.

A239293 Smallest composite c > n such that n^c == n (mod c).

Original entry on oeis.org

4, 341, 6, 6, 10, 10, 14, 9, 12, 15, 15, 22, 21, 15, 21, 20, 34, 25, 38, 21, 28, 33, 33, 25, 28, 27, 39, 36, 35, 49, 49, 33, 44, 35, 45, 42, 45, 39, 57, 52, 82, 66, 77, 45, 55, 69, 65, 49, 56, 51, 65, 65, 65, 55, 63, 57, 65, 66, 87, 65, 91, 63, 93, 65, 70, 78, 85
Offset: 1

Views

Author

Robert FERREOL, Mar 14 2014

Keywords

Comments

a(n) is the smallest weak pseudoprime to base n that is > n.
If n is even and n+1 is composite, then a(n) = n+1. [Corrected by Thomas Ordowski, Aug 03 2018]
Conjecture: a(n) = n+1 if and only if n+1 is an odd composite number. - Thomas Ordowski, Aug 03 2018

Crossrefs

Cf. A000790 (primary pretenders), A007535 (smallest pseudoprimes to base n).
Cf. A002808.

Programs

  • Haskell
    import Math.NumberTheory.Moduli (powerMod)
    a239293 n = head [c | c <- a002808_list, powerMod n c c == n]
    -- Reinhard Zumkeller, Jul 11 2014
    
  • Maple
    L:=NULL: for a to 100 do for n from a+1 while isprime(n) or not(a^n - a mod n =0) do od; L:=L,n od: L;
  • Mathematica
    Table[k = n; While[k++; PrimeQ[k] || PowerMod[n, k, k] != n]; k, {n, 100}] (* T. D. Noe, Mar 17 2014 *)
  • PARI
    a(n) = forcomposite(c=n+1, , if(Mod(n, c)^c==n, return(c))) \\ Felix Fröhlich, Aug 03 2018