login
Parity of p*(p+1)/2 for n-th prime p.
2

%I #43 Apr 10 2021 02:00:23

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

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

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

%N Parity of p*(p+1)/2 for n-th prime p.

%C The following sequences (possibly with a different offset for first term) all appear to have the same parity: A034953 = triangular numbers with prime indices; A054269 = length of period of continued fraction for sqrt(p), p prime; A082749 = difference between the sum of the next prime(n) natural numbers and the sum of the next n primes; A006254 = numbers n such that 2n-1 is prime; A067076 = numbers n such that 2n+3 is a prime.

%C Analogous to the prime race (mod 3). - _Robert G. Wilson v_, Sep 17 2004

%C See also A089253 = 2n-5 is a prime.

%C For n > 1, if A000040(n) == 1 (mod 4), then a(n) = 1, otherwise a(n)=0, so (for n>1) also a(n) = number of representations of A000040(n) as a difference of hexagonal numbers (A000384) (cf. [Nyblom, p. 262]). - _L. Edson Jeffery_, Feb 16 2013

%H Amiram Eldar, <a href="/A098033/b098033.txt">Table of n, a(n) for n = 1..10000</a>

%H M. A. Nyblom, <a href="http://www.fq.math.ca/Scanned/39-3/nyblom.pdf">On the representation of the integers as a difference of nonconsecutive triangular numbers</a>, Fibonacci Quarterly 39:3 (2001), pp. 256-263.

%F a(n) = parity of p*(p+1)/2 for n-th prime p.

%F a(n) = 1 - A100672(n), n > 1. - Steven G. Johnson (stevenj(AT)math.mit.edu), Sep 18 2008

%F For n > 1, a(n) = (prime(n) mod 4) mod 3. - _Gary Detlefs_, Oct 27 2011

%e a(1) = parity of (2*(2+1)/2 = 3) = 1 (odd).

%p seq((ithprime(n) mod 4) mod 3, n = 2..105] # _Gary Detlefs_, Oct 27 2011

%t Table[ Mod[ Prime[n](Prime[n] + 1)/2, 2], {n, 105}] (* _Robert G. Wilson v_, Sep 17 2004 *)

%t Mod[(#(#+1))/2,2]&/@Prime[Range[110]] (* _Harvey P. Dale_, Mar 29 2015 *)

%o (PARI) a(n)=prime(n)%4<3 \\ _Charles R Greathouse IV_, Oct 27 2011

%Y Cf. A034953, A054269, A082749, A006254, A067076, A100672.

%K easy,nonn

%O 1,1

%A _Jeremy Gardiner_, Sep 10 2004

%E More terms from _Robert G. Wilson v_, Sep 17 2004