[go: up one dir, main page]

login
a(n) = n*n in the arithmetic where digits are multiplied in base 10 (as usual) but when digits are to be added they are also multiplied in base 10.
3

%I #16 Oct 21 2022 14:24:52

%S 0,1,4,9,16,25,36,49,64,81,100,111,144,199,306,455,646,179,424,731,

%T 400,441,564,769,1126,505,606,829,1124,1481,900,991,12640,17190,1066,

%U 1355,1086,1259,1304,1651,1000,3440,6120,1749,2126,2605,2886,3569,3864,4841

%N a(n) = n*n in the arithmetic where digits are multiplied in base 10 (as usual) but when digits are to be added they are also multiplied in base 10.

%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 5 and 4 is "added", i.e. multiplied, there is a carry of 2, which here has been added to the 1 to get 3.

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

%e a(14) = 14*14 = 306:

%e ....14

%e ....14

%e ------

%e ....56

%e ...14.

%e ------

%e ...306

%e ------

%o (Python)

%o from math import prod

%o def A169920(m):

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

%o hold = list(zip(*[list(str(int(b)*m).ljust(n-1-a,"X").rjust(n-1,"X")) for a,b in enumerate(str(m))]))#List of products of long multiplication

%o store = []

%o for a,c in enumerate(hold):

%o if c.count('X') == len(c):

%o store.append(0)

%o else:

%o store.append(prod([int(b) for b in c if b.isdigit()])*10**(len(hold)-a-1))

%o return(sum(store))

%o # _David Consiglio, Jr._, Oct 21 2022

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

%K nonn,base

%O 0,3

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

%E More terms from _David Consiglio, Jr._, Oct 21 2022