login
Binary sequence identifying the twin primes (characteristic function of twin primes: 1 if n is a twin prime else 0).
12

%I #25 Aug 05 2021 01:32:33

%S 0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,

%T 0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,

%U 0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0

%N Binary sequence identifying the twin primes (characteristic function of twin primes: 1 if n is a twin prime else 0).

%C Similar to prime binary digit sequence A010051.

%C In decimal notation A164292=0.1646823906345389353962381...

%C See also A164293 (similar to prime decimal sequence A051006).

%C a(A001097(n))=1; a(A001359(n))=1; a(A006512(n))=1. - _Reinhard Zumkeller_, Mar 29 2010

%C Characteristic function of A001097. - _Georg Fischer_, Aug 04 2021

%H Reinhard Zumkeller, <a href="/A164292/b164292.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a> [From _Reinhard Zumkeller_, Mar 29 2010]

%F a(n) = A057427(A010051(n)*(A010051(n-2)+A010051(n+2))), for n>2. - _Reinhard Zumkeller_, Mar 29 2010

%F a(n) = c(n) * ceiling(( c(n+2) + c(n-2) )/2), where c is the prime characteristic. - _Wesley Ivan Hurt_, Jan 31 2014

%t Table[(PrimePi[n] - PrimePi[n - 1]) * Ceiling[(PrimePi[n + 2] - PrimePi[n + 1] + PrimePi[n - 2] - PrimePi[n - 3])/2], {n, 100}] (* _Wesley Ivan Hurt_, Jan 31 2014 *)

%o (Haskell)

%o a164292 1 = 0

%o a164292 2 = 0

%o a164292 n = signum (a010051' n * (a010051' (n - 2) + a010051' (n + 2)))

%o -- _Reinhard Zumkeller_, Feb 03 2014

%Y Cf. A001097, A010051, A051006, A057427, A129950, A164293.

%K nonn

%O 1,1

%A _Carlos Alves_, Aug 12 2009