[go: up one dir, main page]

login
A169919
a(n) = n*n in the arithmetic where digits are added in base 10 (as usual) but when digits are to be multiplied they are also added in base 10.
3
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 220, 242, 264, 286, 308, 330, 352, 374, 396, 418, 440, 462, 484, 506, 528, 550, 572, 594, 616, 638, 660, 682, 704, 726, 748, 770, 792, 814, 836, 858, 880, 902, 924, 946, 968, 990, 1012, 1034, 1056, 1078, 1100, 1122, 1144
OFFSET
0,2
LINKS
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
The four versions are A000290, A169919, A169920, A169921.
Sequence in context: A110725 A100800 A169921 * A292512 A248195 A094041
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Terms a(17)-a(53) from John W. Layman, Jul 22 2010
STATUS
approved