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.

A239147 Numbers n such that there exists a k>0 such that all six of n +/- k, n^2 +/- k, and n^3 +/- k are prime.

This page as a plain text file.
%I A239147 #13 Nov 02 2024 18:22:38
%S A239147 12,25,29,36,45,55,78,87,105,109,111,130,140,141,155,160,190,196,209,
%T A239147 216,231,245,246,265,274,280,289,294,311,315,329,356,364,385,409,441,
%U A239147 444,465,475,489,494,531,535,572,582,600,624,629,650,665
%N A239147 Numbers n such that there exists a k>0 such that all six of n +/- k, n^2 +/- k, and n^3 +/- k are prime.
%C A239147 This is similar to A239146; however, here the numbers listed are the n values for which k != 0.
%C A239147 It is very likely that k does not exist for most n values since k < n for all n. Thus, only the numbers n with some such k (depending on n) are listed.
%e A239147 n = 1,2,3,...11 do not have a k such that n +/- k, n^2 +/- k, and n^3 +/- k are all prime. However, for n = 12, 12 +/- 5 (7 and 17), 12^2 +/- 5 (139 and 149) and 12^3 +/- 5 (1723 and 1733) are all prime. So 12 is a member of this sequence.
%p A239147 isA239147 := proc(n)
%p A239147     local k ;
%p A239147     for k from 1 do
%p A239147         if n-k <= 1 then
%p A239147             return false;
%p A239147         end if;
%p A239147         if isprime(n+k) and isprime(n-k) and isprime(n^2+k)
%p A239147             and isprime(n^2-k) and isprime(n^3+k) and isprime(n^3-k)            then
%p A239147             return true;
%p A239147         end if;
%p A239147     end do;
%p A239147 end proc:
%p A239147 for n from 1 to 800 do
%p A239147     if isA239147(n) then
%p A239147         printf("%d,",n) ;
%p A239147     end if;
%p A239147 end do: # _R. J. Mathar_, Mar 12 2014
%o A239147 (Python)
%o A239147 import sympy
%o A239147 from sympy import isprime
%o A239147 def c(n):
%o A239147   for k in range(n):
%o A239147     if isprime(n+k) and isprime(n-k) and isprime(n**2+k) and isprime(n**2-k) and isprime(n**3+k) and isprime(n**3-k):
%o A239147       return k
%o A239147 n = 1
%o A239147 while n < 10**3:
%o A239147   if c(n) != None:
%o A239147     print(n)
%o A239147   n += 1
%Y A239147 Cf. A239146.
%K A239147 nonn
%O A239147 1,1
%A A239147 _Derek Orr_, Mar 11 2014