login
a(n) = n*n in the arithmetic where when digits are to be added they are multiplied, and when they are to be multiplied they are added.
3

%I #9 Oct 24 2022 15:14:32

%S 0,2,4,6,8,10,12,14,16,18,210,242,294,366,458,620,762,924,2906,3018,

%T 440,492,564,656,768,960,1122,4904,5016,5128,690,762,854,966,1098,

%U 1320,6902,7014,7126,7238,960,1052,1164,1296,1448,8900,9012,9124,9236,9348

%N a(n) = n*n in the arithmetic where when digits are to be added they are multiplied, and when they are to be multiplied they are added.

%C How should the carry digits be handled? In this version they have been handled by simply adding them in the old way, which is a bit worrisome. For example, in the calculation below, when the column containing 7 and 6 is "added", i.e. multiplied, there is a carry of 4, which here has been added to the 2 to get 6.

%H David Consiglio, Jr., <a href="/A169921/b169921.txt">Table of n, a(n) for n = 0..10000</a>

%e a(15) = 15*15 = 620:

%e ....15

%e ....15

%e ------

%e ....70

%e ...26.

%e ------

%e ...620

%e ------

%o (Python)

%o from math import prod

%o def A169921(m):

%o n = len(str(m))+1

%o hold = [x for x in list(zip(*[list(str(sum((int(b)+int(d))*10**a for a,b in enumerate(reversed(str(m))))).ljust(c+n,"X").rjust(8,"X")) for c,d in enumerate(reversed(str(m)))])) if x != ('X',)*(n-1)]

%o store = [prod([int(b) for b in c if b.isdigit()])*10**a for a,c in enumerate(reversed(hold))]

%o return sum(store)

%o # David Consiglio, Oct 24 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 More terms from _David Consiglio, Jr._, Oct 24 2022