A275598 Primes p such that the number of odd divisors of p-1 is a prime q which is equal to the number of odd divisors of p+1.
11, 13, 23, 47, 193, 383, 577
Offset: 1
Keywords
Examples
11 is in this sequence because there are 2 odd divisors 1 and 5 of 10 and there are 2 odd divisors 1 and 3 of 12, and 2 is a prime.
Programs
-
Maple
filter:= proc(p) local r,q; r:= numtheory:-tau((p-1)/2^padic:-ordp(p-1,2)); if not isprime(r) then return false fi; r = numtheory:-tau((p+1)/2^padic:-ordp(p+1,2)) end proc: res:= NULL: p:= 0: while p < 1000 do p:= nextprime(p); if filter(p) then res:= res, p; fi; od: res; # Robert Israel, Aug 24 2016
-
Mathematica
okQ[p_?PrimeQ] := Module[{r}, r = DivisorSigma[0, (p-1)/2^IntegerExponent[p-1, 2]]; If[!PrimeQ[r], Return[False]]; r == DivisorSigma[0, (p+1)/2^IntegerExponent[p+1, 2]]]; Select[Prime[Range[1000]], okQ] (* Jean-François Alcover, Feb 09 2023, after Robert Israel *)
-
PARI
f(n)=numdiv(n>>valuation(n,2)) is(n)=if(!isprime(n), return(0)); my(q=f(n-1)); isprime(q) && f(n+1)==q \\ Charles R Greathouse IV, Aug 24 2016
-
Perl
use ntheory ":all"; forprimes { $n1 = scalar(grep { $&1 } divisors($-1)); say if is_prime($n1) && $n1 == scalar(grep { $&1 } divisors($+1)); } 1e7; # Dana Jacobsen, Aug 24 2016
Comments