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.

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