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.

A156876 Number of primes <= n that are safe primes or Sophie Germain primes.

This page as a plain text file.
%I A156876 #10 Nov 06 2022 07:48:29
%S A156876 0,1,2,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,
%T A156876 7,7,7,7,7,7,8,8,8,8,8,8,9,9,9,9,9,9,10,10,10,10,10,10,11,11,11,11,11,
%U A156876 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12
%N A156876 Number of primes <= n that are safe primes or Sophie Germain primes.
%H A156876 Reinhard Zumkeller, <a href="/A156876/b156876.txt">Table of n, a(n) for n = 1..10000</a>
%F A156876 a(n) = A156874(n)+A156875(n)-A156877(n) = A000720(n)-A156878(n).
%e A156876 a(120) = #{2,3,5,7,11,23,29,41,47,53,59,83,89,107,113} = 15.
%t A156876 Accumulate[Table[If[AllTrue[{n,2n+1},PrimeQ]||AllTrue[{n,(n-1)/2}, PrimeQ],1,0],{n,100}]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Sep 24 2019 *)
%o A156876 (PARI) a(n) = my(nb=0); forprime(p=2, n, if (isprime(2*p+1) || isprime((p-1)/2), nb++)); nb; \\ _Michel Marcus_, Nov 06 2022
%Y A156876 Cf. A156658, A005384, A005385, A000720.
%Y A156876 Cf. A156874, A156875, A156877, A156878.
%K A156876 nonn
%O A156876 1,3
%A A156876 _Reinhard Zumkeller_, Feb 18 2009