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.

This page as a plain text file.
%I A342676 #16 Dec 23 2024 03:07:51
%S A342676 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,
%T A342676 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,
%U A342676 6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7
%N A342676 a(n) is the number of lunar primes less than or equal to n.
%C A342676 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
%C A342676   n       1 10  100  1000 10000 100000 1000000 10000000 100000000 1000000000
%C A342676   a(n)    0  0   18    99  1638  22095  264312  3159111  36694950  418286661
%C A342676   a(n)/n  0  0 0.18 0.099 0.164  0.221   0.264    0.316     0.367      0.418
%C A342676 Conjecture 1: Base 10 lunar prime density approaches 0.9 as n tends to infinity, or lim{n->oo} a(n)/n = 0.9.
%C A342676 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.
%C A342676 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.
%H A342676 D. Applegate, M. LeBrun and N. J. A. Sloane, <a href="http://arxiv.org/abs/1107.1130">Dismal Arithmetic</a>, arXiv:1107.1130 [math.NT], 2011.
%o A342676 (Python)
%o A342676 def addn(m1, m2):
%o A342676     s1, s2 = str(m1), str(m2)
%o A342676     len_max = max(len(s1), len(s2))
%o A342676     return int(''.join(max(i, j) for i, j in zip(s1.rjust(len_max, '0'), s2.rjust(len_max, '0'))))
%o A342676 def muln(m1, m2):
%o A342676     s1, s2, prod = str(m1), str(m2), '0'
%o A342676     for i in range(len(s2)):
%o A342676         k = s2[-i-1]
%o A342676         prod = addn(int(str(prod)), int(''.join(min(j, k) for j in s1))*10**i)
%o A342676     return prod
%o A342676 m = 1; m_size = 2; a = 0; L_im = [9]
%o A342676 while m <= 10**m_size:
%o A342676     for i in range(1, m + 1):
%o A342676         if i == 9: continue
%o A342676         im_st = str(muln(i, m)); im = int(im_st); im_len = len(im_st)
%o A342676         if im_len > m_size: break
%o A342676         if im not in L_im: L_im.append(im)
%o A342676     if m not in L_im: a += 1
%o A342676     print(a); m += 1
%Y A342676 Cf. A087097, A087636, A067139, A087638, A169912, A171000, A130206, A170806, A171143, A171750, A171752.
%K A342676 nonn,base
%O A342676 1,29
%A A342676 _Ya-Ping Lu_, Mar 18 2021