%I #61 Nov 22 2022 02:35:37
%S 1,3,10,21,55,78,136,171,253,406,465,666,820,903,1081,1378,1711,1830,
%T 2211,2485,2628,3081,3403,3916,4656,5050,5253,5671,5886,6328,8001,
%U 8515,9316,9591,11026,11325,12246,13203,13861,14878,15931,16290,18145,18528,19306
%N a(n) = p*(p-1)/2 for p = prime(n).
%C 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
%C From _Jianing Song_, Apr 13 2019: (Start)
%C a(n) is both the number of quadratic residues and the number of nonresidues modulo prime(n)^2 that are coprime to prime(n).
%C For k coprime to prime(n), k^a(n) == +-1 (mod prime(n)^2). (End)
%H Harry J. Smith, <a href="/A008837/b008837.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) = binomial(prime(n), 2) = A000217(A000040(n)). - _Enrique Pérez Herrero_, Dec 10 2011
%F a(n) = (1/2)*A072230(A000040(n)). - _L. Edson Jeffery_, Apr 07 2012
%F 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
%F a(n) = A036689(n)/2. - _Antti Karttunen_, May 01 2015
%F Product_{n>=2} (1 - 1/a(n)) = A271780. - _Amiram Eldar_, Nov 22 2022
%p a:= n-> (p-> p*(p-1)/2)(ithprime(n)):
%p seq(a(n), n=1..65); # _Alois P. Heinz_, Apr 20 2022
%t Table[Prime[n] * (Prime[n] - 1)/2, {n, 22}] (* _Vladimir Joseph Stephan Orlovsky_, Apr 29 2008 *)
%t Table[Binomial[Prime[n], 2], {n, 40}] (* _Alonso del Arte_, Aug 22 2014, based on the formula from _Enrique Pérez Herrero_ *)
%t (#(#-1))/2&/@Prime[Range[50]] (* _Harvey P. Dale_, Oct 02 2019 *)
%o (Magma) [ (k-1)*k/2 where k is NthPrime(n): n in [1..44] ]; // _Klaus Brockhaus_, Nov 18 2008
%o (PARI) { n=0; forprime (p=2, prime(1000), write("b008837.txt", n++, " ", p*(p - 1)/2) ) } \\ _Harry J. Smith_, Jul 25 2009
%o (Scheme) (define (A008837 n) (/ (A036689 n) 2)) ;; _Antti Karttunen_, May 01 2015
%Y Half the terms of A036689.
%Y Cf. A000217 (triangular numbers), A112456 (least triangular number divisible by n-th prime). - _Klaus Brockhaus_, Nov 18 2008
%Y Cf. A000010, A000040, A072230, A034953, A271780.
%Y Column 1 of A257253. (Row 1 of A257254).
%K nonn,easy
%O 1,2
%A _N. J. A. Sloane_, _Ken Levasseur_
%E Offset changed from 2 to 1 by _Harry J. Smith_, Jul 25 2009