OFFSET
1,2
COMMENTS
Whereas A034953 is the sequence of triangular numbers with prime indices, this is the sequence of triangular numbers with numbers one less than primes for indices. - Alonso del Arte, Aug 17 2014
From Jianing Song, Apr 13 2019: (Start)
a(n) is both the number of quadratic residues and the number of nonresidues modulo prime(n)^2 that are coprime to prime(n).
For k coprime to prime(n), k^a(n) == +-1 (mod prime(n)^2). (End)
LINKS
Harry J. Smith, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = (phi(prime(n))^2 + phi(prime(n)))/2, where phi(n) is Euler's totient function, A000010. - Alonso del Arte, Aug 22 2014
a(n) = A036689(n)/2. - Antti Karttunen, May 01 2015
Product_{n>=2} (1 - 1/a(n)) = A271780. - Amiram Eldar, Nov 22 2022
MAPLE
a:= n-> (p-> p*(p-1)/2)(ithprime(n)):
seq(a(n), n=1..65); # Alois P. Heinz, Apr 20 2022
MATHEMATICA
Table[Prime[n] * (Prime[n] - 1)/2, {n, 22}] (* Vladimir Joseph Stephan Orlovsky, Apr 29 2008 *)
Table[Binomial[Prime[n], 2], {n, 40}] (* Alonso del Arte, Aug 22 2014, based on the formula from Enrique Pérez Herrero *)
(#(#-1))/2&/@Prime[Range[50]] (* Harvey P. Dale, Oct 02 2019 *)
PROG
(Magma) [ (k-1)*k/2 where k is NthPrime(n): n in [1..44] ]; // Klaus Brockhaus, Nov 18 2008
(PARI) { n=0; forprime (p=2, prime(1000), write("b008837.txt", n++, " ", p*(p - 1)/2) ) } \\ Harry J. Smith, Jul 25 2009
CROSSREFS
Half the terms of A036689.
Cf. A000217 (triangular numbers), A112456 (least triangular number divisible by n-th prime). - Klaus Brockhaus, Nov 18 2008
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
Offset changed from 2 to 1 by Harry J. Smith, Jul 25 2009
STATUS
approved