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.

A129950 Indicator function of twin primes: 1 if n is a twin prime member, 0 if not prime, -1 else (isolated prime or 2).

This page as a plain text file.
%I A129950 #20 Sep 12 2024 16:04:12
%S A129950 0,-1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,-1,0,0,0,0,0,1,0,1,0,0,
%T A129950 0,0,0,-1,0,0,0,1,0,1,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,1,0,1,0,0,0,0,0,
%U A129950 -1,0,0,0,1,0,1,0,0,0,0,0,-1,0,0,0,-1,0,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0
%N A129950 Indicator function of twin primes: 1 if n is a twin prime member, 0 if not prime, -1 else (isolated prime or 2).
%C A129950 Absolute values are the same as A010051.
%H A129950 Antti Karttunen, <a href="/A129950/b129950.txt">Table of n, a(n) for n = 1..20000</a>
%H A129950 Antti Karttunen, <a href="/A129950/a129950.txt">Data supplement: n, a(n) computed for n = 1..100000</a>
%F A129950 a(n) = 2*A164292(n) - A010051(n). - _Antti Karttunen_, Jan 03 2019
%t A129950 Array[If[PrimeQ@ #, If[Or[PrimeQ[# - 2], PrimeQ[# + 2]], 1, -1], 0] &, 100] (* _Michael De Vlieger_, Jan 03 2019 *)
%o A129950 (PARI) istwin(n) = local(p1, p2); if(n==5,return(2));if(isprime(n),p1=n-2;p2=n+2; if(isprime(p1),return(1));if(isprime(p2),return(-1));return(0))
%o A129950 t(x) = if(abs(istwin(x))==1||x==5,1,if(isprime(x),-1,0))
%o A129950 for(j=1,100,print1(t(j)","))
%o A129950 (PARI) a(n) = if(isprime(n), (-1)^(!isprime(n-2) && !isprime(n+2)), 0); \\ Typos corrected by _Antti Karttunen_, Jan 03 2019
%Y A129950 Cf. A001097, A001359, A006512, A010051, A077800, A164292.
%K A129950 sign
%O A129950 1,1
%A A129950 _Cino Hilliard_, Jun 10 2007
%E A129950 Definition and a(67) corrected by _M. F. Hasler_, Jan 20 2012