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.

A115766 Distance from the n-th prime to the nearest semiprime.

This page as a plain text file.
%I A115766 #8 May 04 2019 16:06:47
%S A115766 2,1,1,1,1,1,2,2,1,3,2,1,2,3,1,2,1,1,2,2,1,2,1,2,2,5,3,1,2,2,2,2,3,2,
%T A115766 3,4,1,2,1,4,1,2,3,1,3,2,2,2,1,3,2,2,4,2,2,1,2,3,1,3,4,2,2,2,1,2,2,2,
%U A115766 1,3,2,1,2,2,2,1,2,1,2,2,2,1,4,4,2,2,2
%N A115766 Distance from the n-th prime to the nearest semiprime.
%C A115766 This is a very slow-growing function. For the first 10^8 primes, the largest value is 45, which occurs for the prime 981270947.
%H A115766 T. D. Noe, <a href="/A115766/b115766.txt">Table of n, a(n) for n = 1..10000</a>
%e A115766 a(10)=3 because 29 is the 10th prime and the nearest semiprime is 26.
%t A115766 SemiPrimeQ[n_] := (2==Plus@@(Transpose[FactorInteger[n]][[2]])); Join[{2}, Table[p=Prime[i]; j=1; While[ !SemiPrimeQ[p+j] && !SemiPrimeQ[p-j], j++ ]; j, {i, 2, 150}]]
%t A115766 dnsm[n_]:=Module[{k=1},While[PrimeOmega[n-k]!=2&&PrimeOmega[n+k]!=2,k++];k]; dnsm/@Prime[Range[90]] (* _Harvey P. Dale_, May 04 2019 *)
%Y A115766 Cf. A001358 (semiprimes).
%K A115766 easy,nonn
%O A115766 1,1
%A A115766 _T. D. Noe_, Jan 30 2006