login
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

%I #11 Jan 03 2022 20:49:00

%S 0,2,4,6,8,10,12,14,16,18,220,242,264,286,308,330,352,374,396,418,440,

%T 462,484,506,528,550,572,594,616,638,660,682,704,726,748,770,792,814,

%U 836,858,880,902,924,946,968,990,1012,1034,1056,1078,1100,1122,1144

%N 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.

%H Michael S. Branicky, <a href="/A169919/b169919.txt">Table of n, a(n) for n = 0..9999</a>

%e a(16) = 16*16 = 352:

%e ....16

%e ....16

%e ------

%e ....82

%e ...27.

%e ------

%e ...352

%e ------

%o (Python)

%o def digits(n): return list(map(int, str(n)))

%o def arith2(m, n):

%o s, t, ans = digits(min(m, n))[::-1], digits(max(m, n))[::-1], 0

%o for i, si in enumerate(s):

%o u, carry = [0 for _ in range(i)], 0

%o for ti in t:

%o # below, if first + --> *, we obtain regular arithmetic

%o carry, ui = divmod(si+ti + carry, 10)

%o u.append(ui)

%o if carry:

%o u.append(carry)

%o ans += int("".join(map(str, u))[::-1])

%o return ans

%o def a(n): return arith2(n, n)

%o print([a(n) for n in range(53)]) # _Michael S. Branicky_, Jan 03 2022

%Y The four versions are A000290, A169919, A169920, A169921.

%K nonn,base

%O 0,2

%A _David Applegate_, _Marc LeBrun_ and _N. J. A. Sloane_, Jul 20 2010

%E Terms a(17)-a(53) from _John W. Layman_, Jul 22 2010