login
A130206
Primes in lunar arithmetic in base 3 written in base 10.
5
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,1
LINKS
D. Applegate, M. LeBrun and N. J. A. Sloane, Dismal Arithmetic, 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]
PROG
(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
CROSSREFS
Cf. A170806.
Sequence in context: A200259 A339746 A262513 * A178502 A047322 A236242
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Sep 30 2010
EXTENSIONS
Entries >=83 from R. J. Mathar, Nov 23 2015
STATUS
approved