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.

A160666 Numbers whose distance to the closest prime number is a prime number.

This page as a plain text file.
%I A160666 #7 Aug 01 2015 21:40:27
%S A160666 0,9,15,21,25,26,27,33,34,35,39,45,49,50,51,55,56,57,63,64,65,69,75,
%T A160666 76,77,81,85,86,87,91,92,94,95,99,105,111,115,116,118,120,122,124,125,
%U A160666 129,133,134,135,141,142,144,146,147,153,154,155,159,160,161,165,169,170
%N A160666 Numbers whose distance to the closest prime number is a prime number.
%C A160666 Terms n=2..31 are identical to terms n=1..30 of A079364.
%H A160666 K. Stern, <a href="/A160666/b160666.txt">Table of n, a(n) for n=1..10000</a>
%p A160666 isA160666 := proc(n) local ppl,pmi ; if isprime(n) then RETURN(false): elif n =0 then RETURN(true): elif n =1 then RETURN(false): fi; ppl := nextprime(n)-n ; pmi := n-prevprime(n) ; RETURN (isprime(min(ppl,pmi)) ) ; end: for n from 0 to 200 do if isA160666(n) then printf("%d,",n) ; fi; od: # _R. J. Mathar_, May 25 2009
%t A160666 fQ[n_] := PrimeQ[ Min[ NextPrime[n] - n, n - NextPrime[n, -1]]]; Select[ Range[0, 174], !PrimeQ@ # && fQ@# &] (* _Robert G. Wilson v_, May 25 2009 *)
%Y A160666 Cf. A000040, A051699.
%K A160666 nonn
%O A160666 1,2
%A A160666 _Kyle Stern_, May 22 2009
%E A160666 More terms from _R. J. Mathar_ and _Robert G. Wilson v_, May 25 2009