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.

Showing 1-5 of 5 results.

A171000 Irreducible Boolean polynomials written as binary vectors.

Original entry on oeis.org

1, 10, 11, 101, 1001, 1011, 1101, 10001, 10011, 10111, 11001, 11101, 100001, 100011, 100101, 100111, 101001, 101011, 110001, 110101, 111001, 1000001, 1000011, 1000101, 1000111, 1001011, 1001101, 1001111, 1010001, 1010011, 1010111, 1011001, 1011101, 1100001
Offset: 1

Views

Author

N. J. A. Sloane, Aug 31 2010

Keywords

Comments

These are the polynomials enumerated in A169912, and written in base 10 in A067139.
This sequence consists of 1 and the lunar primes in base 2 arithmetic. To construct the lunar base 2 primes, start with 10, and repeatedly adjoin the next smallest binary number that is not a lunar base-2 multiple of any earlier number. - N. J. A. Sloane, Jan 26 2011

Crossrefs

Base 3 lunar primes: A130206, A170806.

Programs

  • Python
    def addn(m1, m2):
        s1, s2 = "{0:b}".format(m1), "{0:b}".format(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 =  "{0:b}".format(m1), "{0:b}".format(m2), '0'
        for i in range(len(s2)):
            k = s2[-i-1]
            prod = addn(int(str(prod), 2), int(''.join(min(j, k) for j in s1), 2)*2**i)
        return prod
    L_p10, m = [1], 2
    while m < 100:
        ct = 0
        for i in range(1, len(L_p10)):
            p = L_p10[i]
            for j in range(2, m):
                jp = int(str(muln(j, p)), 2)
                if jp > m: break
                if jp == m: ct += 1; break
            if ct > 0: break
        if ct == 0: L_p10.append(m)
        m += 1
    L_p2 = []
    for d in L_p10: L_p2.append("{0:b}".format(d))
    print(*L_p2, sep =', ') # Ya-Ping Lu, Dec 27 2020

A130206 Primes in lunar arithmetic in base 3 written in base 10.

Original entry on oeis.org

5, 6, 7, 8, 11, 19, 20, 23, 29, 32, 34, 35, 38, 46, 47, 55, 56, 58, 59, 61, 62, 64, 65, 68, 71, 73, 74, 77, 83, 86, 88, 89, 95, 97, 98, 103, 104, 106, 107, 110, 119, 127, 128, 136, 137, 142, 143, 145, 146, 154, 155, 163, 164, 166, 167, 169, 170, 173, 175, 176, 178, 179, 184, 185, 187, 188, 190
Offset: 1

Views

Author

N. J. A. Sloane, Sep 30 2010

Keywords

Crossrefs

Cf. A170806.

Programs

  • Python
    def ternary(m):
        if m == 0: return '0'
        s = []
        while m:
            m, r = divmod(m, 3)
            s.append(str(r))
        return ''.join(reversed(s))
    def addn(m1, m2):
        s1, s2 = ternary(m1), ternary(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 =  ternary(m1), ternary(m2), '0'
        for i in range(len(s2)):
            k = s2[-i-1]
            prod = addn(int(str(prod), 3), int(''.join(min(j, k) for j in s1), 3)*3**i)
        return prod
    for m in range(3,201):
        i, ct = 1, 0
        for i in range(1, m+1):
            if i == 2: continue
            j = i
            for j in range(1, m+1):
                if j == 2: continue
                ij = int(str(muln(i, j)), 3)
                if ij == m: ct += 1; break
            if ct > 0: break
    if ct == 0: print(m) # Ya-Ping Lu, Dec 30 2020

Extensions

Entries >=83 from R. J. Mathar, Nov 23 2015

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

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

Original entry on oeis.org

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, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 22, 22, 23, 23, 24
Offset: 1

Views

Author

Ya-Ping Lu, Mar 18 2021

Keywords

Comments

a(n) and base-2 lunar prime density, a(n)/n, for some n up to 2^39 are
k n = 2^k a(n) a(n)/n
-- ------------ ------------ ----------
1 2 1 0.5
5 32 11 0.34375
10 1024 323 0.31542...
15 32768 5956 0.35430...
20 1048576 424816 0.40513...
25 33554432 14871345 0.44320...
30 1073741824 502585213 0.46806...
35 34359738368 16593346608 0.48292...
39 549755813888 269325457277 0.48990...
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).
a(n) is the n-th partial sum of A342704.

Crossrefs

Programs

  • Python
    def addn(m1, m2):
        s1, s2 = bin(m1)[2:].zfill(0), bin(m2)[2:].zfill(0)
        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 = bin(m1)[2:].zfill(0), bin(m2)[2:].zfill(0), '0'
        for i in range(len(s2)):
            k = s2[-i-1]
            prod = addn(int(str(prod), 2), int(''.join(min(j, k) for j in s1), 2)*2**i)
        return prod
    m = 1; m_size = 7; a = 0; L_im = [1]
    while m <= 2**m_size:
        for i in range(2, m + 1):
            im_st = str(muln(i, m)); im = int(im_st, 2); 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

A191366 Number of base 3 lunar primes of length n.

Original entry on oeis.org

0, 4, 4, 20, 59, 164, 544, 1730, 5471, 17765, 55050, 173906, 546893
Offset: 1

Views

Author

David Applegate and N. J. A. Sloane, May 31 2011

Keywords

Crossrefs

Extensions

Additional term from David Applegate, Jun 07 2011
Showing 1-5 of 5 results.