%I #16 Dec 23 2024 03:07:51
%S 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 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 6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7
%N a(n) is the number of lunar primes less than or equal to n.
%C 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 n 1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000
%C a(n) 0 0 18 99 1638 22095 264312 3159111 36694950 418286661
%C a(n)/n 0 0 0.18 0.099 0.164 0.221 0.264 0.316 0.367 0.418
%C 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 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 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 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 (Python)
%o def addn(m1, m2):
%o s1, s2 = str(m1), str(m2)
%o len_max = max(len(s1), len(s2))
%o return int(''.join(max(i, j) for i, j in zip(s1.rjust(len_max, '0'), s2.rjust(len_max, '0'))))
%o def muln(m1, m2):
%o s1, s2, prod = str(m1), str(m2), '0'
%o for i in range(len(s2)):
%o k = s2[-i-1]
%o prod = addn(int(str(prod)), int(''.join(min(j, k) for j in s1))*10**i)
%o return prod
%o m = 1; m_size = 2; a = 0; L_im = [9]
%o while m <= 10**m_size:
%o for i in range(1, m + 1):
%o if i == 9: continue
%o im_st = str(muln(i, m)); im = int(im_st); im_len = len(im_st)
%o if im_len > m_size: break
%o if im not in L_im: L_im.append(im)
%o if m not in L_im: a += 1
%o print(a); m += 1
%Y Cf. A087097, A087636, A067139, A087638, A169912, A171000, A130206, A170806, A171143, A171750, A171752.
%K nonn,base
%O 1,29
%A _Ya-Ping Lu_, Mar 18 2021