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.

A001751 Primes together with primes multiplied by 2.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 10, 11, 13, 14, 17, 19, 22, 23, 26, 29, 31, 34, 37, 38, 41, 43, 46, 47, 53, 58, 59, 61, 62, 67, 71, 73, 74, 79, 82, 83, 86, 89, 94, 97, 101, 103, 106, 107, 109, 113, 118, 122, 127, 131, 134, 137, 139, 142, 146, 149, 151, 157, 158, 163, 166
Offset: 1

Views

Author

Keywords

Comments

For n > 1, a(n) is position of primes in A026741.
For n > 1, a(n) is the position of the ones in A046079. - Ant King, Jan 29 2011
A251561(a(n)) != a(n). - Reinhard Zumkeller, Dec 27 2014
Number of terms <= n is pi(n) + pi(n/2). - Robert G. Wilson v, Aug 04 2017
Number of terms <=10^k: 7, 40, 263, 1898, 14725, 120036, 1013092, 8762589, 77203401, 690006734, 6237709391, 56916048160, 523357198488, 4843865515369, ..., . - Robert G. Wilson v, Aug 04 2017
Complement of A264828. - Chai Wah Wu, Oct 17 2024

Crossrefs

Union of A001747 and A000040.
Subsequence of A039698 and of A033948.

Programs

  • Haskell
    a001751 n = a001751_list !! (n-1)
    a001751_list = 2 : filter (\n -> (a010051 $ div n $ gcd 2 n) == 1) [1..]
    -- Reinhard Zumkeller, Jun 20 2011 (corrected, improved), Dec 17 2010
    
  • Mathematica
    Select[Range[163], Or[PrimeQ[#], PrimeQ[1/2 #]] &] (* Ant King, Jan 29 2011 *)
    upto=200;With[{pr=Prime[Range[PrimePi[upto]]]},Select[Sort[Join[pr,2pr]],# <= upto&]] (* Harvey P. Dale, Sep 23 2014 *)
  • PARI
    isA001751(n)=isprime(n/gcd(n,2)) || n==2
    
  • PARI
    list(lim)=vecsort(concat(primes(primepi(lim)), 2* primes(primepi(lim\2)))) \\ Charles R Greathouse IV, Oct 31 2012
    
  • Python
    from sympy import primepi
    def A001751(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+x-primepi(x)-primepi(x>>1))
        return bisection(f,n,n) # Chai Wah Wu, Oct 17 2024

A253046 An involution of the natural numbers: if n = 2*p_i then replace n with 3*p_{i+1}, and conversely if n = 3*p_i then replace n with 2*p_{i-1}, where p_i denotes the i-th prime.

Original entry on oeis.org

1, 2, 3, 9, 5, 15, 7, 8, 4, 21, 11, 12, 13, 33, 6, 16, 17, 18, 19, 20, 10, 39, 23, 24, 25, 51, 27, 28, 29, 30, 31, 32, 14, 57, 35, 36, 37, 69, 22, 40, 41, 42, 43, 44, 45, 87, 47, 48, 49, 50, 26, 52, 53, 54, 55, 56, 34, 93, 59, 60, 61, 111, 63, 64, 65, 66, 67
Offset: 1

Views

Author

N. J. A. Sloane, Dec 26 2014

Keywords

Comments

a(m) != m iff m is a term of A253106, i.e., a semiprime divisible by 2 or 3; a(A100484(n)) > A100484(n); a(A001748(n)) < A001748(n). - Reinhard Zumkeller, Dec 26 2014

Crossrefs

Programs

  • Haskell
    a253046 n | i == 0 || p > 3 = n
              | p == 2          = 3 * a000040 (i + 1)
              | otherwise       = 2 * a000040 (i - 1)
                where i = a049084 (div n p);  p = a020639 n
    -- Reinhard Zumkeller, Dec 26 2014
    
  • Mathematica
    a253046[n_] := Block[{f},
      f[x_] := Which[PrimeQ[x/2], 3 NextPrime[x/2],
        PrimeQ[x/3], 2 NextPrime[x/3, -1],
    True, x];Array[f, n]]; a253046[67] (* Michael De Vlieger, Dec 27 2014 *)
  • Python
    from sympy import isprime, nextprime, prevprime
    def A253046(n):
        q2, r2 = divmod(n,2)
        if not r2 and isprime(q2):
            return 3*nextprime(q2)
        else:
            q3, r3 = divmod(n,3)
            if not r3 and isprime(q3):
                return 2*prevprime(q3)
            return n # Chai Wah Wu, Dec 27 2014
Showing 1-2 of 2 results.