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.

A321578 a(n) is the maximum value of k such that A007504(k) <= prime(n).

This page as a plain text file.
%I A321578 #20 Jun 29 2025 11:07:14
%S A321578 1,1,2,2,3,3,4,4,4,5,5,5,6,6,6,6,7,7,7,7,7,8,8,8,8,9,9,9,9,9,9,10,10,
%T A321578 10,10,10,10,11,11,11,11,11,11,11,12,12,12,12,12,12,12,13,13,13,13,13,
%U A321578 13,13,13,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15
%N A321578 a(n) is the maximum value of k such that A007504(k) <= prime(n).
%C A321578 Let A be A007504. The number of distinct values of k such that a(k)=r is the number of primes p in the interval A(r) <= p < A(r+1); namely: 2,2,2,3,3,4,5,4,6,6,... (see A323701). Let b(n) be the smallest r such that a(r)=n, namely: 1,3,5,7,10,13,17,22,26,... For given n, if k is the index of the smallest prime >= A(n), then b(n)=k. (The equality applies when n is a term of A013916.)
%H A321578 Michael De Vlieger, <a href="/A321578/b321578.txt">Table of n, a(n) for n = 1..10000</a>
%e A321578 a(1)=1 since prime(1)=2 and 1 is max k such that A007504(k) <= 2.
%e A321578 a(5)=3 since prime(5)=11 and 3 is max k such that A007504(k) <= 11.
%e A321578 n=4 (in A013916). A(4)=17=prime(7), so b(4)=7.
%e A321578 n=7 (not in A013916). A(7)=58 < 59=prime(17), so b(7)=17.
%t A321578 nn = 75; MapIndexed[Set[s[First[#2]], #1] &, Accumulate[Prime@ Range[nn]]]; k = 1; Table[p = Prime[n]; While[s[k] <= p, k++]; k - 1, {n, nn}] (* _Michael De Vlieger_, Jun 29 2025 *)
%o A321578 (Perl) use ntheory ':all'; sub a { my $p = nth_prime($_[0]); my($s, $q) = (0, 2); while ($s <= $p) { $s += $q; $q = next_prime($q) }; prime_count($q-1)-1 }; print join(", ", map { a($_) } 1..100), "\n"; # _Daniel Suteu_, Jan 26 2019
%o A321578 (PARI) a(n) = my(k=0, p=0, s=0); while(s <= prime(n), k++; p=nextprime(p+1); s+=p); k-1; \\ _Michel Marcus_, Feb 19 2019
%Y A321578 Cf. A000040, A007504, A013916, A323701, A061568.
%K A321578 nonn
%O A321578 1,3
%A A321578 _David James Sycamore_, Nov 12 2018