login
Von Staudt primes which are not safe primes (A005385).
1

%I #10 Jan 27 2014 07:41:16

%S 239,443,647,659,827,1223,1259,1499,1787,1847,2087,2243,2339,2687,

%T 2699,3299,3659,3767,4943,5903,6263,6287,6299,6563,6863,6959,7043,

%U 7487,7583,7883,7907,7919,8087,8219,8243,8387,8627,8663

%N Von Staudt primes which are not safe primes (A005385).

%H Jean-François Alcover, <a href="/A152952/b152952.txt">Table of n, a(n) for n = 1..100</a>

%H P. Luschny, <a href="http://www.luschny.de/math/zeta/VonStaudtPrimes.html">Von Staudt prime number, definition and computation.</a>

%e 239 is a von Staudt prime because the denominator(B(239-1)/(239-1))=239*12, where B(n) is the Bernoulli number, but (239-1)/2=119=7*17 is not a prime.

%p a := proc(n) local k,L; L:= []; for k from 11 by 12 to n do map(i->i+1,divisors(k-1)); select(isprime,%) minus {2,3}; if % = {k} then L := [op(L),k] fi; od; select(isprime,map(i->i+i+1,select(isprime,[$1..iquo(n,2)]))): sort(convert(convert(L,set) minus convert(%,set),list)): end:

%t vonStaudtPrimeQ[p_?PrimeQ] := Denominator[BernoulliB[p-1]/(p-1)] == 12*p; safePrimeQ[p_?PrimeQ] := PrimeQ[(p-1)/2]; Reap[For[p = 2, p < 10^4, p = NextPrime[p], If[vonStaudtPrimeQ[p] && !safePrimeQ[p], Print[p]; Sow[p]]]][[2, 1]] (* _Jean-François Alcover_, Jan 27 2014 *)

%Y Cf. A092307, A005385 and A152951.

%K nonn

%O 1,1

%A _Peter Luschny_, Dec 25 2008