cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

2, 2, 4, 8, 15, 29, 55, 105, 197, 367, 678, 1261, 2326, 4293, 7902, 14431, 26363, 47899
Offset: 0

Views

Author

N. J. A. Sloane, Jun 01 2011

Keywords

Crossrefs

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

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

Extensions

a(16) and a(17) from R. J. Mathar, Nov 23 2015