OFFSET
0,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..9999
EXAMPLE
a(16) = 16*16 = 352:
....16
....16
------
....82
...27.
------
...352
------
PROG
(Python)
def digits(n): return list(map(int, str(n)))
def arith2(m, n):
s, t, ans = digits(min(m, n))[::-1], digits(max(m, n))[::-1], 0
for i, si in enumerate(s):
u, carry = [0 for _ in range(i)], 0
for ti in t:
# below, if first + --> *, we obtain regular arithmetic
carry, ui = divmod(si+ti + carry, 10)
u.append(ui)
if carry:
u.append(carry)
ans += int("".join(map(str, u))[::-1])
return ans
def a(n): return arith2(n, n)
print([a(n) for n in range(53)]) # Michael S. Branicky, Jan 03 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Terms a(17)-a(53) from John W. Layman, Jul 22 2010
STATUS
approved