The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A236747 Number of 0 <= k <= sqrt(n) such that n-k and n+k are both prime. 3
0, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 2, 0, 1, 1, 1, 2, 1, 1, 1, 0, 2, 1, 0, 1, 0, 0, 2, 1, 0, 1, 1, 0, 1, 2, 1, 0, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 2, 0, 2, 1, 1, 1, 1, 0, 2, 0, 1, 1, 0, 1, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,5
COMMENTS
Probably a(n) > N for any N and all sufficiently large n. Perhaps a(2591107) is the last 0 in this sequence. - Charles R Greathouse IV, Jan 30 2014
Primes p such that a(p)=1: 2, 3, 7, 11, 13, 17, 19, ... . Juri-Stepan Gerasimov, Feb 02 2014
LINKS
FORMULA
a(n) = Sum_{k=0..A000196(n)} (A010051(n-k) * A010051(n+k)). - Antti Karttunen, Feb 01 2014
EXAMPLE
a(3) = 1 because 3 - 0 = 3 and 3 + 0 = 3 are both prime for k = 0;
a(4) = 1 because 4 - 1 = 3 and 4 + 1 = 5 are both prime for k = 1 < sqrt(4) = 2;
a(5) = 2 because 5 - 0 = 5 and 5 + 0 = 5 are both prime for k = 0, 5 - 2 = 3 and 5 + 2 = 7 are both prime for k = 2 < sqrt(5).
MAPLE
A236767 := proc(n)
local a, k ;
a := 0 ;
for k from 0 to floor(sqrt(n)) do
if isprime(n-k) and isprime(n+k) then
a := a+1 ;
end if;
end do:
a ;
end proc:
seq(A236767(n), n=1..80) ; # R. J. Mathar, Dec 01 2020
MATHEMATICA
Table[Length[Select[Range[0, Sqrt[n]], PrimeQ[n - #] && PrimeQ[n + #] &]], {n, 100}] (* T. D. Noe, Feb 01 2014 *)
PROG
(PARI) a(n)=sum(k=0, sqrtint(n), isprime(n-k)&&isprime(n+k)) \\ Charles R Greathouse IV, Jan 30 2014
(Scheme)
(define (A236747 n) (add (lambda (k) (* (A010051 (- n k)) (A010051 (+ n k)))) 0 (A000196 n)))
;; The following implements sum_{i=lowlim..uplim} intfun(i):
(define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
;; From Antti Karttunen, Feb 01 2014
CROSSREFS
Sequence in context: A073490 A279907 A225654 * A194285 A367623 A336676
KEYWORD
nonn
AUTHOR
EXTENSIONS
Terms recomputed (with corrections) by Antti Karttunen, Feb 01 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 4 17:49 EDT 2024. Contains 373102 sequences. (Running on oeis4.)