A303978 a(n) is the smallest prime p that does not divide n-1 such that (n^p-1)/(n-1) is composite, for n > 1.
11, 5, 5, 5, 11, 7, 2, 3, 5, 3, 7, 11, 2, 5, 7, 13, 3, 5, 2, 7, 11, 3, 2, 5, 2, 5, 7, 3, 3, 11, 2, 5, 2, 3, 3, 5, 2, 3, 11, 7, 3, 11, 2, 3, 11, 3, 2, 5, 2, 3, 5, 3, 2, 5, 2, 5, 5, 5, 3, 11, 2, 3, 2, 3, 11, 5, 2, 5, 5, 11, 3, 11, 2, 5, 2, 7, 5, 7, 2, 3, 5, 3, 2, 11, 2, 3, 5, 5, 2
Offset: 2
Keywords
Examples
The repunit (10^5-1)/9 = 11111 = 41*271 is composite, so a(10) = 5, because (10^2-1)/9 = 11 is prime and 3 divides 9.
Crossrefs
Cf. A298756.
Programs
-
Maple
f:= proc(n) local p; p:= 2; while n-1 mod p = 0 or isprime((n^p-1)/(n-1)) do p:= nextprime(p) od: p end proc: map(p, [$2..100]); # Robert Israel, May 04 2018
-
Mathematica
Array[Block[{p = 2}, While[Nand[CoprimeQ[# - 1, p], CompositeQ[(#^p - 1)/(# - 1)]], p = NextPrime@ p]; p] &, 89, 2] (* Michael De Vlieger, May 06 2018 *)
-
PARI
a(n) = {forprime(p=2,,if (((n-1) % p) && !isprime((n^p-1)/(n-1)), return (p)););} \\ Michel Marcus, May 04 2018
Extensions
More terms from Michel Marcus, May 04 2018
Comments