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.

Showing 1-2 of 2 results.

A089237 List of primes and squares.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 7, 9, 11, 13, 16, 17, 19, 23, 25, 29, 31, 36, 37, 41, 43, 47, 49, 53, 59, 61, 64, 67, 71, 73, 79, 81, 83, 89, 97, 100, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139, 144, 149, 151, 157, 163, 167, 169, 173, 179, 181, 191, 193, 196, 197, 199, 211, 223, 225, 227
Offset: 1

Views

Author

N. J. A. Sloane, Dec 11 2003

Keywords

Comments

Starting at a(1) = 1, this is the lexicographically earliest sequence of distinct numbers whose partial products are all exponentially odd numbers (A268335). - Amiram Eldar, Sep 24 2024

Crossrefs

Programs

  • Haskell
    a089237 n = a089237_list !! (n-1)
    a089237_list = merge a000040_list a000290_list where
       merge xs'@(x:xs) ys'@(y:ys) =
             if x < y then x : merge xs ys' else y : merge xs' ys
    -- Reinhard Zumkeller, Dec 18 2012
    
  • Mathematica
    m=100; Sort[Flatten[{Range[0,m]^2, Prime[Range[PrimePi[m^2]]]}]] (* Zak Seidov, Nov 05 2009 *)
  • PARI
    is(n)=isprime(n) || issquare(n) \\ Charles R Greathouse IV, Oct 14 2016
    
  • PARI
    {A89237=List([0..5]); A089237(n)=while(#A89237A340389. - M. F. Hasler, Jul 24 2021, edited Sep 01 2021
    
  • Python
    from math import isqrt
    from sympy import primepi
    def A089237(n):
        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
        def f(x): return int(n-1+x-primepi(x)-isqrt(x))
        return bisection(f,n-1,n-1) # Chai Wah Wu, Oct 12 2024

Formula

a(A161187(n)+1) = A000290(n); a(A161188(n)+1) = A000040(n). - Reinhard Zumkeller, Dec 18 2012
A010051(a(n)) + A010052(a(n)) = 1. - Reinhard Zumkeller, Jul 07 2014
a(n) ~ n log n. - Charles R Greathouse IV, Oct 14 2016

A161187 Let S = A089237\{0} = union of primes and nonzero squares; sequence gives indices of squares.

Original entry on oeis.org

1, 4, 7, 10, 14, 17, 22, 26, 31, 35, 41, 46, 52, 58, 63, 70, 78, 84, 91, 98, 106, 114, 122, 129, 139, 148, 156, 165, 175, 184, 193, 204, 214, 225, 235, 246, 256, 266, 279, 291, 304, 316, 326, 339, 351, 365, 376, 390, 406, 417, 429, 445, 462, 475, 489, 501, 514
Offset: 1

Views

Author

Daniel Tisdale, Jun 06 2009

Keywords

Crossrefs

Cf. A089237. Complement of A161188.
Cf. A050052.

Programs

  • Haskell
    a161187 n = a161187_list !! (n-1)
    a161187_list = tail $ findIndices ((== 1) . a010052) a089237_list
    -- Reinhard Zumkeller, Dec 18 2012
    
  • Magma
    [1] cat [#PrimesUpTo(n^2-1)+n: n in [2..100]]; // Vincenzo Librandi, Feb 18 2016
    
  • Mathematica
    Table[PrimePi[n^2 - 1] + n, {n, 60}] (* Vincenzo Librandi, Feb 18 2016 *)
  • Python
    from sympy import primepi
    def A161187(n): return n+primepi(n**2) # Chai Wah Wu, Oct 12 2024

Formula

A089237(a(n)+1) = A000290(n). - Reinhard Zumkeller, Dec 18 2012

Extensions

Edited by N. J. A. Sloane, Jun 07 2009
Extended by Ray Chandler, May 06 2010
Showing 1-2 of 2 results.