Lunar arithmetic, also called dismal arithmetic, is a system of operations on nonnegative integers in a fixed base , where
is an integer. Digit
addition takes the maximum and digit
multiplication takes the minimum. For larger numbers,
addition combines corresponding digits, and multiplication
combines shifted partial products without carries (Applegate et al. 2011,
pp. 2 and 4-5).
Write
and
, padding the base-
expansions with leading zeros. The output
digits are
|
(1)
| |||
|
(2)
|
where . These operations form a commutative semiring with additive identity
element 0 and multiplicative identity
(Applegate et al. 2011, pp. 5-7).
A lunar prime in base is a number other than
whose only factorizations
under
have a factor equal to
. In base 10, the first lunar
primes are 19, 29, 39, 49, 59, 69, 79, 89, 90, 91, ... (OEIS A087097;
Applegate et al. 2011, p. 7). Every lunar prime must contain the digit
, but this condition is not sufficient:
(Applegate et al. 2011, p. 7).