|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|