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.

This page as a plain text file.
%I A130206 #25 Jan 06 2021 15:42:21
%S A130206 5,6,7,8,11,19,20,23,29,32,34,35,38,46,47,55,56,58,59,61,62,64,65,68,
%T A130206 71,73,74,77,83,86,88,89,95,97,98,103,104,106,107,110,119,127,128,136,
%U A130206 137,142,143,145,146,154,155,163,164,166,167,169,170,173,175,176,178,179,184,185,187,188,190
%N A130206 Primes in lunar arithmetic in base 3 written in base 10.
%H A130206 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. [Note: we have now changed the name from "dismal arithmetic" to "lunar arithmetic" - the old name was too depressing]
%H A130206 <a href="/index/Di#dismal">Index entries for sequences related to dismal (or lunar) arithmetic</a>
%o A130206 (Python)
%o A130206 def ternary(m):
%o A130206     if m == 0: return '0'
%o A130206     s = []
%o A130206     while m:
%o A130206         m, r = divmod(m, 3)
%o A130206         s.append(str(r))
%o A130206     return ''.join(reversed(s))
%o A130206 def addn(m1, m2):
%o A130206     s1, s2 = ternary(m1), ternary(m2)
%o A130206     len_max = max(len(s1), len(s2))
%o A130206     return int(''.join(max(i, j) for i, j in zip(s1.rjust(len_max, '0'), s2.rjust(len_max, '0'))))
%o A130206 def muln(m1, m2):
%o A130206     s1, s2, prod =  ternary(m1), ternary(m2), '0'
%o A130206     for i in range(len(s2)):
%o A130206         k = s2[-i-1]
%o A130206         prod = addn(int(str(prod), 3), int(''.join(min(j, k) for j in s1), 3)*3**i)
%o A130206     return prod
%o A130206 for m in range(3,201):
%o A130206     i, ct = 1, 0
%o A130206     for i in range(1, m+1):
%o A130206         if i == 2: continue
%o A130206         j = i
%o A130206         for j in range(1, m+1):
%o A130206             if j == 2: continue
%o A130206             ij = int(str(muln(i, j)), 3)
%o A130206             if ij == m: ct += 1; break
%o A130206         if ct > 0: break
%o A130206 if ct == 0: print(m) # _Ya-Ping Lu_, Dec 30 2020
%Y A130206 Cf. A170806.
%K A130206 nonn,base
%O A130206 1,1
%A A130206 _N. J. A. Sloane_, Sep 30 2010
%E A130206 Entries >=83 from _R. J. Mathar_, Nov 23 2015