A190820 In base-2 lunar arithmetic, number of distinct squares of length 2n+1.
2, 2, 4, 8, 15, 29, 55, 105, 197, 367, 678, 1261, 2326, 4293, 7902, 14431, 26363, 47899
Offset: 0
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.
- Index entries for sequences related to dismal (or lunar) arithmetic
Programs
-
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:
Formula
Extensions
a(16) and a(17) from R. J. Mathar, Nov 23 2015