The OEIS is supported by the many generous donors to the OEIS Foundation.

Numbers k with the property that k is the product of two distinct primes whose difference is also the product of two distinct primes.

8

`%I #36 Dec 27 2023 23:44:26
`

`%S 34,39,46,51,55,74,82,87,91,95,106,111,118,119,123,134,142,155,158,
`

`%T 178,183,187,194,203,215,226,247,262,267,287,291,299,314,326,327,335,
`

`%U 358,371,391,395,407,411,422,446,447,478,502,527,538,543,551,586,591,611,614
`

`%N Numbers k with the property that k is the product of two distinct primes whose difference is also the product of two distinct primes.
`

`%C The number of times this process can be repeated would be called the order of the number. For example, 82 is the smallest number of this type of order 2.
`

`%H Robert Israel, <a href="/A296096/b296096.txt">Table of n, a(n) for n = 1..10000</a>
`

`%e 51 is a number of this type since 51=3*17 and 17-3=14 are also the product of two distinct primes.
`

`%p N:= 10^4: # to get all terms <= N
`

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

`%p P2:= {}:
`

`%p for i from 1 to nops(P) while P[i]^2 <= N do
`

`%p for j from i+1 while P[i]*P[j] <= N do od:
`

`%p P2:= P2 union {seq(P[i]*P[k],k=i+1..j-1)};
`

`%p od:
`

`%p P3:= {}:
`

`%p for i from 1 to nops(P) while P[i]^2 <= N do
`

`%p for j from i+1 while P[i]*P[j] <= N do od:
`

`%p Q:= map(`-`,convert(P[i+1..j-1],set),P[i]) intersect P2;
`

`%p P3:= P3 union map(t -> (t+P[i])*P[i], Q);
`

`%p od:
`

`%p sort(convert(P3,list)); # _Robert Israel_, Jan 05 2018
`

`%t Select[Range[6, 614], And[AllTrue[#, PrimeQ], Length@ # == 2, FactorInteger[First@ Differences@ #][[All, -1]] == {1, 1}] &@ Most@ Rest@ Divisors@ # &] (* _Michael De Vlieger_, Dec 13 2017 *)
`

`%o (Sage)
`

`%o for n in range(1,100):
`

`%o L=list(factor(n))
`

`%o itsemiprime=false
`

`%o degree=-1
`

`%o if len(L)==2 and L[0][1]==1 and L[1][1]==1:
`

`%o itsemiprime=true
`

`%o while len(L)==2:
`

`%o if L[0][1]==1 and L[1][1]==1:
`

`%o L=list(factor(L[1][0]-L[0][0]))
`

`%o temp=len(L)
`

`%o degree=degree+1
`

`%o else:
`

`%o break
`

`%o if itsemiprime:
`

`%o n, degree
`

`%o (PARI) isok1(n) = (bigomega(n)==2) && issquarefree(n);
`

`%o isok(n) = isok1(n) && (f=factor(n)) && isok1(f[2,1]-f[1,1]); \\ _Michel Marcus_, Dec 21 2017
`

`%Y Cf. A006881.
`

`%K nonn
`

`%O 1,1
`

`%A _Carl Lienert_ and Pamela K. M. Smith, Dec 04 2017
`