OFFSET
0,1
LINKS
D. Applegate, M. LeBrun and N. J. A. Sloane, Dismal Arithmetic, arXiv:1107.1130 [math.NT], 2011. [Note: we have now changed the name from "dismal arithmetic" to "lunar arithmetic" - the old name was too depressing]
D. Applegate, M. LeBrun, and N. J. A. Sloane, Dismal Arithmetic, J. Int. Seq. 14 (2011) # 11.9.8.
FORMULA
MAPLE
rebase := proc(L)
add( op(i, L)*2^(i-1), i=1..nops(L)) ;
end proc:
dismadd := proc(a, b)
local adgs, bdgs, alen, blen, L, i ;
adgs := convert(a, base, 2) ;
bdgs := convert(b, base, 2) ;
alen := nops(adgs) ;
blen := nops(bdgs) ;
L := [] ;
for i from 1 to max(alen, blen) do
if i <= alen and i <= blen then
L := [op(L), max(op(i, adgs), op(i, bdgs))] ;
elif i <= alen then
L := [op(L), op(i, adgs)] ;
else
L := [op(L), op(i, bdgs)] ;
end if;
end do:
rebase(L) ;
end proc:
dismult := proc(a, b)
local bdgs, blen, c, i ;
if b = 0 then
return 0;
end if;
bdgs := convert(b, base, 2) ;
blen := nops(bdgs) ;
if blen = 1 then
# cannot be 0 (already above), so b=1
return a;
else
c := 0 ;
for i from 1 to blen do
if op(i, bdgs) <> 0 then
c := dismadd(c, 2^(i-1)*a ) ;
end if;
end do:
end if;
c ;
end proc:
A190820 := proc(n)
local c, sq;
sq := {} ;
# length of square is 2*n+1 = 2*len(i)-1, so len(i)=n+1.
for c from 2^n to 2^(n+1)-1 do
sq := sq union { dismult(c, c) } ;
end do:
nops(sq) ;
end proc:
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
N. J. A. Sloane, Jun 01 2011
EXTENSIONS
a(16) and a(17) from R. J. Mathar, Nov 23 2015
STATUS
approved