login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A190820 In base-2 lunar arithmetic, number of distinct squares of length 2n+1. 3

%I #38 Apr 14 2021 05:28:39

%S 2,2,4,8,15,29,55,105,197,367,678,1261,2326,4293,7902,14431,26363,

%T 47899

%N In base-2 lunar arithmetic, number of distinct squares of length 2n+1.

%H D. Applegate, M. LeBrun and N. J. A. Sloane, <a href="http://arxiv.org/abs/1107.1130">Dismal Arithmetic</a>, 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]

%H D. Applegate, M. LeBrun, and N. J. A. Sloane, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL14/Sloane/carry2.html">Dismal Arithmetic</a>, J. Int. Seq. 14 (2011) # 11.9.8.

%H <a href="/index/Di#dismal">Index entries for sequences related to dismal (or lunar) arithmetic</a>

%F a(n) = #{k in A067398: A070939(k)=2*n+1}. - _R. J. Mathar_, Nov 23 2015

%p rebase := proc(L)

%p add( op(i,L)*2^(i-1),i=1..nops(L)) ;

%p end proc:

%p dismadd := proc(a,b)

%p local adgs,bdgs,alen,blen,L,i ;

%p adgs := convert(a,base,2) ;

%p bdgs := convert(b,base,2) ;

%p alen := nops(adgs) ;

%p blen := nops(bdgs) ;

%p L := [] ;

%p for i from 1 to max(alen,blen) do

%p if i <= alen and i <= blen then

%p L := [op(L),max(op(i,adgs),op(i,bdgs))] ;

%p elif i <= alen then

%p L := [op(L),op(i,adgs)] ;

%p else

%p L := [op(L),op(i,bdgs)] ;

%p end if;

%p end do:

%p rebase(L) ;

%p end proc:

%p dismult := proc(a,b)

%p local bdgs,blen,c,i ;

%p if b = 0 then

%p return 0;

%p end if;

%p bdgs := convert(b,base,2) ;

%p blen := nops(bdgs) ;

%p if blen = 1 then

%p # cannot be 0 (already above), so b=1

%p return a;

%p else

%p c := 0 ;

%p for i from 1 to blen do

%p if op(i,bdgs) <> 0 then

%p c := dismadd(c, 2^(i-1)*a ) ;

%p end if;

%p end do:

%p end if;

%p c ;

%p end proc:

%p A190820 := proc(n)

%p local c,sq;

%p sq := {} ;

%p # length of square is 2*n+1 = 2*len(i)-1, so len(i)=n+1.

%p for c from 2^n to 2^(n+1)-1 do

%p sq := sq union { dismult(c,c) } ;

%p end do:

%p nops(sq) ;

%p end proc:

%Y Cf. A067398, A191342.

%K nonn,base,more

%O 0,1

%A _N. J. A. Sloane_, Jun 01 2011

%E a(16) and a(17) from _R. J. Mathar_, Nov 23 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 7 07:20 EDT 2024. Contains 372300 sequences. (Running on oeis4.)