OFFSET
0,3
COMMENTS
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.
LINKS
David Consiglio, Jr., Table of n, a(n) for n = 0..10000
EXAMPLE
a(14) = 14*14 = 306:
....14
....14
------
....56
...14.
------
...306
------
PROG
(Python)
from math import prod
def A169920(m):
n = len(str(m*m))+1
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
store = []
for a, c in enumerate(hold):
if c.count('X') == len(c):
store.append(0)
else:
store.append(prod([int(b) for b in c if b.isdigit()])*10**(len(hold)-a-1))
return(sum(store))
# David Consiglio, Jr., Oct 21 2022
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
More terms from David Consiglio, Jr., Oct 21 2022
STATUS
approved