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.

A342676 a(n) is the number of lunar primes less than or equal to n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7
Offset: 1

Views

Author

Ya-Ping Lu, Mar 18 2021

Keywords

Comments

The density of lunar primes seems to approach a nonzero fraction in contrast to that of the classical primes, which approaches zero as n tends to infinity. a(n) and lunar prime density, a(n)/n, for n up to 10^9 are
n 1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000
a(n) 0 0 18 99 1638 22095 264312 3159111 36694950 418286661
a(n)/n 0 0 0.18 0.099 0.164 0.221 0.264 0.316 0.367 0.418
Conjecture 1: Base 10 lunar prime density approaches 0.9 as n tends to infinity, or lim{n->oo} a(n)/n = 0.9.
D. Applegate, M. LeBrun and N. J. A. Sloane conjectured that the number of base b lunar primes with k digits approaches (b-1)^2*b^(k-2) as k tends to infinity. And necessary conditions for a number n to be prime are that it contain b-1 as a digit and (if k > 2) does not end with 0 (see Links). Since the number of base b integers with k digits equals b^k - b^(k-1), the lunar prime density among integers with k digits should be (b-1)^2*b^(k-2)/(b^k - b^(k-1)), which is 1 - 1/b as k -> oo, if the conjecture holds. Note that, as b increases, the limit approaches 1, or lim_{b->oo} lim_{n->oo} a(n)/n = 1. As n tends to infinity, the probability of finding a base b number having a digit of b-1 approaches 100%, and the probability of finding a base b number ending with 0 approaches 1/b. Therefore, essentially all numbers except those ending with 0 are lunar primes as n tends to infinity.
Conjecture 2: Base b lunar prime density approaches 1 - 1/b as n tends to infinity, or lim{n->oo} a(n)/n = 1 - 1/b.

Crossrefs

Programs

  • Python
    def addn(m1, m2):
        s1, s2 = str(m1), str(m2)
        len_max = max(len(s1), len(s2))
        return int(''.join(max(i, j) for i, j in zip(s1.rjust(len_max, '0'), s2.rjust(len_max, '0'))))
    def muln(m1, m2):
        s1, s2, prod = str(m1), str(m2), '0'
        for i in range(len(s2)):
            k = s2[-i-1]
            prod = addn(int(str(prod)), int(''.join(min(j, k) for j in s1))*10**i)
        return prod
    m = 1; m_size = 2; a = 0; L_im = [9]
    while m <= 10**m_size:
        for i in range(1, m + 1):
            if i == 9: continue
            im_st = str(muln(i, m)); im = int(im_st); im_len = len(im_st)
            if im_len > m_size: break
            if im not in L_im: L_im.append(im)
        if m not in L_im: a += 1
        print(a); m += 1