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.

A376699 Positions of primes in the sequence of numbers of the form 2^i * 3^j - 1 (A069353).

Original entry on oeis.org

3, 4, 5, 6, 8, 10, 11, 13, 15, 16, 18, 21, 22, 25, 31, 32, 36, 39, 40, 42, 51, 57, 61, 63, 65, 66, 71, 73, 79, 82, 94, 97, 106, 107, 110, 120, 121, 127, 128, 129, 130, 138, 142, 144, 161, 192, 204, 205, 212, 216, 232, 234, 244, 259, 264, 265, 308, 329, 346, 348
Offset: 1

Views

Author

Amiram Eldar, Oct 02 2024

Keywords

Crossrefs

Programs

  • Mathematica
    With[{lim = 10^10}, Position[Sort@ Flatten@ Table[2^i*3^j - 1, {i, 0, Log2[lim]}, {j, 0, Log[3, lim/2^i]}], _?PrimeQ] // Flatten]
  • PARI
    lista(lim) = {my(s = List()); for(i = 0, logint(lim, 2), for(j = 0, logint(lim >> i, 3), listput(s, 2^i * 3^j - 1))); s = Set(s); for(i = 1, #s, if(isprime(s[i]), print1(i, ", ")));}
    
  • Python
    from itertools import count, islice
    from sympy import isprime, integer_log
    def A069353(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = 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 n+x-sum(((x+1)//3**i).bit_length() for i in range(integer_log(x+1,3)[0]+1))
        return bisection(f,n-1,n-1)
    def A376699_gen(): # generator of terms
        return filter(lambda n:isprime(A069353(n)), count(1))
    A376699_list = list(islice(A376699_gen(),30)) # Chai Wah Wu, Mar 31 2025

Formula

A069353(a(n)) = A003586(a(n)) - 1 = A005105(n).