login
Semiprimes of the form p*q such that p+q-1 is prime.
2

%I #14 Aug 23 2017 03:15:45

%S 4,9,15,33,35,49,51,65,77,87,91,95,119,123,143,161,177,185,209,213,

%T 215,217,221,247,259,287,303,321,329,335,341,361,371,377,395,403,407,

%U 411,427,437,447,469,473,485,511,515,527,533,537,545,551,573,581,591,611,629

%N Semiprimes of the form p*q such that p+q-1 is prime.

%C Obviously, 4 is the only even term.

%C The terms divisible by 3 are 3*A001359. - _Robert Israel_, Aug 22 2017

%H Charles R Greathouse IV, <a href="/A291318/b291318.txt">Table of n, a(n) for n = 1..10000</a>

%e 4 = 2*2 and 2+2-1 is prime, so 4 is a term.

%e 185 = 5*37 and 5+37-1 is prime, so 185 is a term.

%p N:= 1000: # to get terms <= N

%p OddPrimes:= select(isprime, [seq(i,i=3..N/3,2)]):

%p R:= select(t -> t[1]*t[2]<= N and isprime(t[1]+t[2]-1), [[2,2],seq(seq([OddPrimes[i],OddPrimes[j]],j=1..i),i=1..nops(OddPrimes))]):

%p sort(map(t -> t[1]*t[2],R)); # _Robert Israel_, Aug 22 2017

%t With[{nn=60}, Take[#, nn]&@Union@Flatten@Table[Function[p, Map[Times@@#&@#&, #]&@Select[Map[{p, #}&, Prime@Range[PrimePi@p]], PrimeQ[Total@# - 1] &]]@Prime@n,{n, nn + 4}]]

%t (* Second program: *)

%t Select[Range@ 630, And[Length@ # == 2, PrimeQ[First@ # + Last@ # - 1]] &@

%t Flatten@Map[ConstantArray[#1, #2] & @@ # &, FactorInteger[#]] &] (* _Michael De Vlieger_, Aug 22 2017 *)

%o (PARI) list(lim)=my(v=List([4])); forprime(p=3,lim\3, forprime(q=3,min(lim\p,p), if(isprime(p+q-1), listput(v,p*q)))); Set(v) \\ _Charles R Greathouse IV_, Aug 23 2017

%Y Cf. A001358, A001359, A290434.

%K nonn,easy

%O 1,1

%A _Vincenzo Librandi_, Aug 22 2017