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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A276983 Semiprimes n such that n-1 or n+1 is prime. 1

%I #33 Aug 22 2022 04:59:07

%S 4,6,10,14,22,38,46,58,62,74,82,106,158,166,178,194,226,262,278,314,

%T 346,358,382,398,422,458,466,478,502,542,562,586,614,662,674,718,734,

%U 758,838,862,878,886,982,998,1018,1094,1154,1186,1202,1214,1238,1282,1306,1318,1322

%N Semiprimes n such that n-1 or n+1 is prime.

%C Union of A077065 and A077068.

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

%F a(n) = 2*A120628(n).

%e a(3) = 10 = 2*5 is a product of 2 primes and 10+1 = 11 is prime.

%e a(4) = 14 = 2*7 is a product of 2 primes and 14-1 = 13 is prime.

%p select(t -> isprime(t/2) and (isprime(t-1) or isprime(t+1)), [seq(i,i=2..10000,2)]); # _Robert Israel_, Sep 30 2016

%t func[n_] := PrimeOmega[n] == 2 && (PrimeQ[n + 1] || PrimeQ[n - 1])

%t Select[Range[1000], func[#] &]

%o (PARI) isok(n) = (bigomega(n)==2) && (isprime(n-1) || isprime(n+1)); \\ _Michel Marcus_, Sep 24 2016

%o (PARI) lista(nn) = forprime(p=2, nn, if(isprime(2*p+1) || isprime(2*p-1), print1(2*p, ", "))); \\ _Altug Alkan_, Sep 30 2016

%o (Python)

%o from sympy import isprime, primerange

%o def aupto(N): return [t for t in (2*p for p in primerange(2, N//2+1)) if isprime(t-1) or isprime(t+1)]

%o print(aupto(1322)) # _Michael S. Branicky_, Aug 21 2022

%Y Cf. A001358, A077065, A077068, A120628.

%K nonn

%O 1,1

%A _Gary E. Davis_, Sep 24 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)