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.

A087061 Array A(n, k) = lunar sum n + k (n >= 0, k >= 0) read by antidiagonals.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 3, 2, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 7, 6, 5, 4, 4, 5, 6, 7, 8, 7, 6, 5, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 11, 11, 9, 8, 7, 6, 6, 7, 8, 9, 11, 11, 12, 11, 12, 9, 8, 7, 6, 7, 8, 9, 12, 11, 12, 13, 12, 12, 13, 9, 8
Offset: 0

Views

Author

Marc LeBrun, Oct 09 2003

Keywords

Comments

There are no carries in lunar arithmetic. For each pair of lunar digits, to Add, take the lArger, but to Multiply, take the sMaller. For example:
169
+ 248
------
269
and
169
x 248
------
168
144
+ 122
--------
12468
Addition and multiplication are associative and commutative and multiplication distributes over addition. E.g., 357 * (169 + 248) = 357 * 269 = 23567 = 13567 + 23457 = (357 * 169) + (357 * 248). Note that 0 + x = x and 9*x = x for all x.
We have changed the name from "dismal arithmetic" to "lunar arithmetic" - the old name was too depressing. - N. J. A. Sloane, Aug 06 2014

Examples

			Lunar addition table A(n, k) begins:
   [0] 0  1  2  3  4  5  6  7  8  9 10 11 12 13 ...
   [1] 1  1  2  3  4  5  6  7  8  9 11 11 12 13 ...
   [2] 2  2  2  3  4  5  6  7  8  9 12 12 12 13 ...
   [3] 3  3  3  3  4  5  6  7  8  9 13 13 13 13 ...
   [4] 4  4  4  4  4  5  6  7  8  9 14 14 14 14 ...
   [5] 5  5  5  5  5  5  6  7  8  9 15 15 15 15 ...
   [6] 6  6  6  6  6  6  6  7  8  9 16 16 16 16 ...
   [7] 7  7  7  7  7  7  7  7  8  9 17 17 17 17 ...
   [8] 8  8  8  8  8  8  8  8  8  9 18 18 18 18 ...
   [9] 9  9  9  9  9  9  9  9  9  9 19 19 19 19 ...
    ...
Seen as a triangle T(n, k):
   [0] 0;
   [1] 1, 1;
   [2] 2, 1, 2;
   [3] 3, 2, 2, 3;
   [4] 4, 3, 2, 3, 4;
   [5] 5, 4, 3, 3, 4, 5;
   [6] 6, 5, 4, 3, 4, 5, 6;
   [7] 7, 6, 5, 4, 4, 5, 6, 7;
   [8] 8, 7, 6, 5, 4, 5, 6, 7, 8;
   [9] 9, 8, 7, 6, 5, 5, 6, 7, 8, 9;
		

Crossrefs

Cf. A087062 (multiplication), A087097 (primes), A004197, A003056.

Programs

  • Maple
    # Maple programs for lunar arithmetic are in A087062.
    # Seen as a triangle:
    T := (n, k) -> if n - k > k then n - k else k fi:
    for n from 0 to 9 do seq(T(n, k), k = 0..n) od; # Peter Luschny, May 07 2023
  • Mathematica
    ladd[x_, y_] := FromDigits[MapThread[Max, IntegerDigits[#, 10, Max @@ IntegerLength /@ {x, y}] & /@ {x, y}]]; Flatten[Table[ladd[k, n - k], {n, 0, 13}, {k, 0, n}]] (* Davin Park, Sep 29 2016 *)
  • PARI
    ladd=A087061(m,n)=fromdigits(vector(if(#(m=digits(m))>#n=digits(n),#n=Vec(n,-#m),#m<#n,#m=Vec(m,-#n),#n),k,max(m[k],n[k]))) \\  M. F. Hasler, Nov 12 2017, updated Nov 15 2018

Formula

T(n, k) = n - k if n - k > k, otherwise k, if seen as a triangle. See A004197, which is a kind of dual. In fact T(n, k) + A004197(n, k) = A003056(n, k). - Peter Luschny, May 07 2023

Extensions

Edited by M. F. Hasler, Nov 12 2017