login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A008837
a(n) = p*(p-1)/2 for p = prime(n).
30
1, 3, 10, 21, 55, 78, 136, 171, 253, 406, 465, 666, 820, 903, 1081, 1378, 1711, 1830, 2211, 2485, 2628, 3081, 3403, 3916, 4656, 5050, 5253, 5671, 5886, 6328, 8001, 8515, 9316, 9591, 11026, 11325, 12246, 13203, 13861, 14878, 15931, 16290, 18145, 18528, 19306
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
FORMULA
a(n) = binomial(prime(n), 2) = A000217(A000040(n)). - Enrique Pérez Herrero, Dec 10 2011
a(n) = (1/2)*A072230(A000040(n)). - L. Edson Jeffery, Apr 07 2012
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
(Scheme) (define (A008837 n) (/ (A036689 n) 2)) ;; Antti Karttunen, May 01 2015
CROSSREFS
Half the terms of A036689.
Cf. A000217 (triangular numbers), A112456 (least triangular number divisible by n-th prime). - Klaus Brockhaus, Nov 18 2008
Column 1 of A257253. (Row 1 of A257254).
Sequence in context: A295063 A298856 A006308 * A176098 A355389 A081950
KEYWORD
nonn,easy
EXTENSIONS
Offset changed from 2 to 1 by Harry J. Smith, Jul 25 2009
STATUS
approved