cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A008837 a(n) = p*(p-1)/2 for p = prime(n).

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