A191311 Numbers n such that exactly half of the a such that 0
4, 6, 15, 91, 703, 1891, 2701, 11305, 12403, 13981, 18721, 23001, 30889, 38503, 39865, 49141, 68101, 79003, 88561, 88831, 91001, 93961, 104653, 107185, 137149, 146611, 152551, 157641, 176149, 188191, 204001, 218791, 226801, 228241
Offset: 1
Links
- David W. Wilson and Robert G. Wilson v, Table of n, a(n) for n = 1..2157
- While exploring Carmichael numbers, I noticed a few values on the chart on this page for which exactly half of the relatively prime witnesses to the Fermat primality test were false witnesses.
Crossrefs
Programs
-
Mathematica
fQ[n_] := Block[{pf = First /@ FactorInteger@ n}, 2Times @@ GCD[n - 1, pf - 1] == n*Times @@ (1 - 1/pf)]; Select[ Range@ 250000, fQ] (* Robert G. Wilson v, Aug 08 2011 *)
-
Python
import math for x in range(2, 1000): false_witnesses = 0 relatively_prime_values = 0 for y in range(x): if math.gcd(y, x) == 1: relatively_prime_values += 1 if (pow(y, x-1, x) == 1): false_witnesses += 1 if false_witnesses * 2 == relatively_prime_values: print(x, "is a Fermat Half-Prime")
Formula
Extensions
Edited by N. J. A. Sloane, Jun 07 2011. I made use of a more explicit definition due to Gareth McCaughan, Jun 05 2011.
Comments