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.

A135721 a(n) is the smallest Carmichael number (A002997) divisible by the n-th prime, or 0 if no such number exists.

Original entry on oeis.org

561, 1105, 1729, 561, 1105, 561, 1729, 6601, 2465, 2821, 29341, 6601, 334153, 62745, 2433601, 74165065, 29341, 8911, 10024561, 10585, 2508013, 55462177, 62745, 46657, 101101, 52633, 84350561, 188461, 278545, 1152271, 18307381, 410041, 2628073, 12261061, 838201
Offset: 2

Views

Author

Artur Jasinski, Nov 25 2007

Keywords

Examples

			561 is the first Carmichael number and its prime factors are 3, 11, 17 (2nd, 5th and 7th primes), so a(2), a(5) and a(7) are equal to 561. - _Michel Marcus_, Nov 07 2013
		

Crossrefs

Programs

  • Mathematica
    c = Cases[Range[1, 10000000, 2], n_ /; Mod[n, CarmichaelLambda@ n] == 1 && ! PrimeQ@ n]; Table[First@ Select[c, Mod[#, Prime@ n] == 0 &], {n, 2, 16}] (* Michael De Vlieger, Aug 28 2015, after Artur Jasinski at A002997 *)
  • PARI
    Korselt(n)=my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2]>1||(n-1)%(f[i, 1]-1), return(0))); 1
    isA002997(n)=n%2 && !isprime(n) && Korselt(n) && n>1
    a(n) = my(pn=prime(n),cn = 31*pn); until (isA002997(cn+=2*pn),); cn; \\ Michel Marcus, Nov 07 2013, improved by M. F. Hasler, Apr 14 2015
    
  • PARI
    Korselt(n)=my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2]>1||(n-1)%(f[i, 1]-1), return(0))); 1
    a(n,p=prime(n))=my(m=lift(Mod(1/p,p-1)),c=max(m,33)*p,mp=m*p); while(!isprime(c) && !Korselt(c), c+=mp); c \\ Charles R Greathouse IV, Apr 15 2015

Extensions

More terms from Michel Marcus, Nov 07 2013
Escape clause added by Jianing Song, Dec 12 2021