cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A289548 The lesser of two semiprime brothers.

This page as a plain text file.
%I A289548 #54 Sep 14 2021 12:11:57
%S A289548 9,14,21,26,403,12367,41303,66893,68297,73147,111607,116813,118003,
%T A289548 130133,146873,222757,260497,418307,429491,439097,478061,559003,
%U A289548 628241,729007,822397,1116707,1239869,1595683,1887239,2148589,2225669,2481463,2502977,2539553
%N A289548 The lesser of two semiprime brothers.
%C A289548 Semiprime brothers are two consecutive semiprimes (A001358) whose prime factors are consecutive primes (A000040).
%C A289548 The first several examples of semiprime brothers are {9, 10}, {14, 15}, {21, 22}, {26, 33} & {403, 407}.
%C A289548 The only square term is 9 and the only even terms are 14 and 26.
%C A289548 Obviously the difference between the primepi of the factors of the two consecutive semiprimes is either {-1, 1} or {1, -1}.
%C A289548 Number of terms < 10^n: 1, 4, 5, 5, 10, 25, 62, 143, 319, 761, 2010, 5275, etc.
%C A289548 Only the first three terms have as the next semiprime the next integer making them twins. - _Robert G. Wilson v_, Jun 21 2018
%H A289548 Jonathan Vos Post, Robert G. Wilson v, and Giovanni Resta, <a href="/A289548/b289548.txt">Table of n, a(n) for n = 1..5275</a> (terms < 10^12, terms > 10^10 from G. Resta)
%e A289548 26 is in the sequence because 26 = 2*13 and the next semiprime is 33 = 3*11 with 2 & 3 consecutive primes and 11 & 13 consecutive primes.
%e A289548 403 is in the sequence because 403 = 13*31 and the next semiprime is 407 = 11*37 with 11 & 13 and 31 & 37 being consecutive primes.
%t A289548 p = q = 4; fp = fq = {1, 1}; lst = {}; While[p < 26000000, While[fq = Flatten[ Table[#1, {#2}] & @@@ FactorInteger@ q]; Length@ fq != 2, q++]; d = Sort[{fp, fq}]; If[ NextPrime[ d[[1, 1]]] == d[[2, 1]] && NextPrime[ d[[2, 2]]] == d[[1, 2]], AppendTo[lst, p]]; p = q; fp = fq; q++]; lst
%o A289548 (PARI) isok(p, q) = (nextprime(p+1) == q) || (nextprime(q+1) == p);
%o A289548 pairp(n) = if (issquare(n), vector(2, k, sqrtint(n)), (factor(n)[,1])~);
%o A289548 lista(nn) = {na = 2; while (na < nn, if (bigomega(na) != 2, na++, nb = na + 1; while (bigomega(nb) != 2, nb++); fpa = pairp(na); fpb = pairp(nb); if (isok(fpa[1], fpb[1]) && isok(fpa[2], fpb[2]), print1(na, ", ")); na = nb;););} \\ _Michel Marcus_, Jul 11 2017
%o A289548 (Python)
%o A289548 from sympy import factorint, nextprime
%o A289548 def is_semiprime(n):
%o A289548     return sum(e for e in factorint(n).values()) == 2
%o A289548 def next_semiprime(n):
%o A289548     nxt = n + 1
%o A289548     while not is_semiprime(nxt): nxt += 1
%o A289548     return nxt
%o A289548 def are_consecutive(p, q):
%o A289548     return max(p, q) == nextprime(min(p, q))
%o A289548 def ok(n):
%o A289548     if not is_semiprime(n): return False
%o A289548     nextsp = next_semiprime(n)
%o A289548     fn, fm = factorint(n, multiple=True), factorint(nextsp, multiple=True)
%o A289548     return are_consecutive(fn[0], fm[0]) and are_consecutive(fn[1], fm[1])
%o A289548 print(list(filter(ok, range(150000)))) # _Michael S. Branicky_, Sep 14 2021
%Y A289548 Cf. A000040, A001358.
%K A289548 nonn
%O A289548 1,1
%A A289548 _Jonathan Vos Post_ and _Robert G. Wilson v_, Jul 07 2017