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.

A245716 Least number k > 0 such that n + k! and n - k! are both prime, or 0 if no such k exists.

This page as a plain text file.
%I A245716 #11 Jul 30 2014 20:25:58
%S A245716 0,0,0,1,2,1,0,0,2,0,3,1,3,0,2,0,3,1,0,0,2,0,3,0,3,0,0,0,4,1,0,0,0,0,
%T A245716 3,0,3,0,2,0,0,1,4,0,2,0,3,0,0,0,0,0,3,0,4,0,0,0,0,1,0,0,0,0,3,0,3,0,
%U A245716 2,0,0,1,3,0,0,0,3,0,0,0,2,0,4,0,4,0,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,1,3,0,2,0,3,1,0,0,2,0,4,0,0,0,0,0,0,0
%N A245716 Least number k > 0 such that n + k! and n - k! are both prime, or 0 if no such k exists.
%C A245716 For a(n) > 0, a(n)! < n for all n. Thus a(n) = 0 is definite.
%H A245716 Jens Kruse Andersen, <a href="/A245716/b245716.txt">Table of n, a(n) for n = 1..10000</a>
%e A245716 13 + 1! and 13 - 1! are not both prime.
%e A245716 13 + 2! and 13 - 2! are not both prime.
%e A245716 13 + 3! and 13 - 3! are both prime (19 and 7). Thus a(13) = 3.
%o A245716 (PARI)
%o A245716 a(n)=for(k=1,n,if(ispseudoprime(n-k!)&&ispseudoprime(n+k!),return(k)))
%o A245716 vector(150,n,a(n))
%Y A245716 Cf. A245714, A245715.
%K A245716 nonn
%O A245716 1,5
%A A245716 _Derek Orr_, Jul 30 2014