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.

A337877 Numbers of the form p^2*q where p and q are primes and p <= q.

Original entry on oeis.org

8, 12, 20, 27, 28, 44, 45, 52, 63, 68, 76, 92, 99, 116, 117, 124, 125, 148, 153, 164, 171, 172, 175, 188, 207, 212, 236, 244, 261, 268, 275, 279, 284, 292, 316, 325, 332, 333, 343, 356, 369, 387, 388, 404, 412, 423, 425, 428, 436, 452, 475, 477, 508, 524, 531, 539, 548, 549, 556, 575, 596, 603
Offset: 1

Views

Author

Robert Israel, Sep 27 2020

Keywords

Examples

			a(3) = 20 is a term because 20=2^2*5 with 2 <= 5.
		

Crossrefs

Contained in A337806.

Programs

  • Maple
    N:= 3000: # for terms <= N
    P:= select(isprime, [2,seq(i,i=3..N/2,2)]): nP:= nops(P):
    R:= NULL:
    for i from 1 to nP do
      p2:= P[i]^2;
      for j from i to nP do
        x:= p2*P[j];
        if x > N then break fi;
        R:= R, x
    od od:
    sort([R]);
  • Python
    from sympy import primepi, primerange, integer_nthroot
    def A337877(n):
        def f(x): return int(n+x-sum(primepi(x//k**2)-a for a,k in enumerate(primerange(integer_nthroot(x,3)[0]+1))))
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        return bisection(f) # Chai Wah Wu, Aug 29 2024