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.

A074818 Number of integers in {1, 2, ..., prime(n)} that are coprime to n.

This page as a plain text file.
%I A074818 #12 Jun 04 2025 18:53:34
%S A074818 2,2,4,4,9,5,15,10,16,12,29,13,38,19,26,27,56,21,64,29,42,36,80,30,78,
%T A074818 47,69,46,106,31,123,66,84,66,103,51,153,78,104,70,175,52,187,88,106,
%U A074818 96,207,75,195,92,147,111,237,84,187,113,170,131,273,75,279,142,176
%N A074818 Number of integers in {1, 2, ..., prime(n)} that are coprime to n.
%C A074818 Compare the definition of a(n) to phi(n) = number of integers in {1, 2, ..., n} that are coprime to n.
%F A074818 a(n) = Sum_{d|n} mu(d)*floor(prime(n)/d). - _Ridouane Oudra_, Jun 04 2025
%e A074818 There are five numbers in {1, 2, ..., prime(6) = 13} that are coprime to 6, i.e. 1, 5, 7, 11, 13. Hence a(6) = 5.
%p A074818 with(numtheory): seq(add(mobius(d)*floor(ithprime(n)/d), d in divisors(n)), n=1..100) ; # _Ridouane Oudra_, Jun 04 2025
%t A074818 h[n_] := Module[{l}, l = {}; For[i = 1, i <= Prime[n], i++, If[GCD[i, n] == 1, l = Append[l, i]]]; l]; Table[Length[h[i]], {i, 1, 100}]
%o A074818 (PARI) a(n) = sum(k=1, prime(n), gcd(k, n)==1); \\ _Michel Marcus_, Jun 04 2025
%o A074818 (PARI) a(n) = my(p = prime(n)); eulerphi(n) * (p \ n) + sum(i = (p \ n)*n + 1, p, gcd(i, n) == 1); \\ _David A. Corneth_, Jun 04 2025
%Y A074818 Cf. A000010, A000040, A004648, A008683.
%Y A074818 Cf. A129139, A074919, A074882, A074933, A074934, A057828.
%K A074818 nonn
%O A074818 1,1
%A A074818 _Joseph L. Pe_, Oct 04 2002