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.

A342678 a(n) is the number of base-2 lunar primes less than or equal to n.

This page as a plain text file.
%I A342678 #9 Apr 01 2021 14:46:39
%S A342678 0,1,2,2,3,3,3,3,4,4,5,5,6,6,6,6,7,7,8,8,8,8,9,9,10,10,10,10,11,11,11,
%T A342678 11,12,12,13,13,14,14,15,15,16,16,17,17,17,17,17,17,18,18,18,18,19,19,
%U A342678 19,19,20,20,20,20,20,20,20,20,21,21,22,22,23,23,24
%N A342678 a(n) is the number of base-2 lunar primes less than or equal to n.
%C A342678 a(n) and base-2 lunar prime density, a(n)/n, for some n up to 2^39 are
%C A342678    k        n = 2^k           a(n)       a(n)/n
%C A342678   --   ------------   ------------   ----------
%C A342678    1              2              1   0.5
%C A342678    5             32             11   0.34375
%C A342678   10           1024            323   0.31542...
%C A342678   15          32768           5956   0.35430...
%C A342678   20        1048576         424816   0.40513...
%C A342678   25       33554432       14871345   0.44320...
%C A342678   30     1073741824      502585213   0.46806...
%C A342678   35    34359738368    16593346608   0.48292...
%C A342678   39   549755813888   269325457277   0.48990...
%C A342678 Conjecture: base-2 lunar prime density approaches 0.5 as n tends to infinity, i.e., lim_{n->oo} a(n)/n = 0.5 (see Comments section in A342676).
%C A342678 a(n) is the n-th partial sum of A342704.
%H A342678 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 A342678 (Python)
%o A342678 def addn(m1, m2):
%o A342678     s1, s2 = bin(m1)[2:].zfill(0), bin(m2)[2:].zfill(0)
%o A342678     len_max = max(len(s1), len(s2))
%o A342678     return int(''.join(max(i, j) for i, j in zip(s1.rjust(len_max, '0'), s2.rjust(len_max, '0'))))
%o A342678 def muln(m1, m2):
%o A342678     s1, s2, prod = bin(m1)[2:].zfill(0), bin(m2)[2:].zfill(0), '0'
%o A342678     for i in range(len(s2)):
%o A342678         k = s2[-i-1]
%o A342678         prod = addn(int(str(prod), 2), int(''.join(min(j, k) for j in s1), 2)*2**i)
%o A342678     return prod
%o A342678 m = 1; m_size = 7; a = 0; L_im = [1]
%o A342678 while m <= 2**m_size:
%o A342678     for i in range(2, m + 1):
%o A342678         im_st = str(muln(i, m)); im = int(im_st, 2); im_len = len(im_st)
%o A342678         if im_len > m_size: break
%o A342678         if im not in L_im: L_im.append(im)
%o A342678     if m not in L_im: a += 1
%o A342678     print(a); m += 1
%Y A342678 Cf. A342704, A342676, A087097, A087636, A067139, A169912, A171000, A130206, A170806, A171143, A171750, A171752.
%K A342678 nonn,base
%O A342678 1,3
%A A342678 _Ya-Ping Lu_, Mar 18 2021