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.

A131872 Set m = 0, n = 1. Find smallest k >= 2 such that pi(k) = (k-pi(k)) - (m-pi(m)); set a(n) = pi(k), m = k, n = n+1. Repeat.

This page as a plain text file.
%I A131872 #10 Feb 16 2025 08:33:06
%S A131872 1,4,8,11,16,23,30,39,50,62,78,97,119,141,172,205,242,284,334,393,455,
%T A131872 531,615,704,811,928,1059,1213,1373,1560,1761,1988,2239,2524,2833,
%U A131872 3180,3557,3983,4448,4942,5503,6126,6791,7522,8331,9228,10188,11228
%N A131872 Set m = 0, n = 1. Find smallest k >= 2 such that pi(k) = (k-pi(k)) - (m-pi(m)); set a(n) = pi(k), m = k, n = n+1. Repeat.
%C A131872 For n>1, a(n)-a(n-1) is approximately pi(n)^2/n.
%H A131872 A. Granville and G. Martin, <a href="https://arxiv.org/abs/math/0408319">Prime number races</a>, arXiv:math/0408319 [math.NT], 2004.
%H A131872 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimeCountingFunction.html">Prime Counting Function</a>
%e A131872 m=0, n=1; pi(2) = (2-1)-(0) = 1 = number of nonprimes from 1 to 2, a(1) = 1 is a term. Now n=2, m=2.
%e A131872 pi(9) = (9-4)-(2-1) = 4 = number of nonprimes from 3 to 9, a(2) = 4 is a term. Now n=3, m=9.
%e A131872 pi(21) = (21-8)-(9-4) = 8 = number of nonprimes from 10 to 21, a(3) = 8 is a term.
%t A131872 m=0; Do[If[PrimePi[n]==(n-PrimePi[n])-(m-PrimePi[m]), Print[PrimePi[n]]; m=n], {n, 1, 10^6, 1}]
%o A131872 (PARI) lista(nn) = my(m=0, list = List()); for (n=1, nn, my(k=2); while(primepi(k) != (k-primepi(k)) - (m-primepi(m)), k++); listput(list, primepi(k)); m = k;); Vec(list); \\ _Michel Marcus_, Nov 13 2023
%Y A131872 Cf. A000720, A062298.
%K A131872 nonn
%O A131872 1,2
%A A131872 _Manuel Valdivia_, Oct 05 2007
%E A131872 Edited by _N. J. A. Sloane_, Nov 05 2007