[seqfan] Re: 2D extension to A327474

M. F. Hasler oeis at hasler.fr
Fri Jan 27 20:15:02 CET 2023


I understood it otherwise: we have the set of n² points
P = { (x,y) ;  1 <= x,y <= n }
and want to know  a(n) = card { avg(S) ; S \subset P }
where avg(S) is the sum of all elements of S divided by max(number of
elements, 1)
(which yields 0 = (empty sum) / 1  for S = {}).
(We could take complex numbers x+iy instead of points (x,y).)
I get:
a(n=0,1,2, 3...) = (1, 2, 14, 158, 1410, ...)
For example, a(2) = 14 with the 14 barycenters
[0, [1, 1], [1, 2], [1, 3/2], [2, 1], [2, 2], [2, 3/2], [3/2, 1], [3/2, 2],
[3/2, 3/2], [4/3, 4/3], [4/3, 5/3], [5/3, 4/3], [5/3, 5/3]]
where PARI wrote [ [x,y] ...] instead of { (x,y) ... }.

There are 2^(n^2) possible subsets, which is why the brute force approach
gets slow for n > 4.

- Maximilian
PS: brute force PARI code:
a(n)={my(P=concat([[ x+I*y | x<-[1..n]] | y<-[1..n]])*lcm([1..2^n]), S=[]);
for(m=1,2^#P-1,
S=setunion(S,[vecsum(vecextract(P,m))/hammingweight(m)]));#S+1)}


On Fri, Jan 27, 2023 at 6:21 AM Richard J. Mathar <mathar at mpia-hd.mpg.de>
wrote:

> I get 1, 7, 66, 383,.. for distinct centers of mass
> of binary square nXn arrays of n=1,2,3,4...
>
> The [x,y] means for n=1 are [0,0] (it does not matter whether
> the cell is occupied or not, the mean is the same).
> The [x,y] means for n=2 are
> {[1, 1], [1/2, 1/2], [0, 0], [0, 1/2], [1/2, 0], [1/2, 1], [1, 1/2]}
>
> brute force Maple code:
>
> # L is a list of sequentialized positions of 1, members in the range
> 0..n*m-1
> # n is the number of rows, m the number of columns
> # by modulo and remainder division of a member of L through m
> # we get the x and y positions in the range 0..m-1 and 0..n-1
> Aaux := proc(L,n,m)
>         local xsum,ysum,lin,x,y ;
>         xsum := 0 ;
>         ysum := 0 ;
>         for lin in L do
>                 x := modp(lin,m) ;
>                 y := floor(lin/m) ;
>                 xsum := xsum+x ;
>                 ysum := ysum+y ;
>         end do:
>         [xsum/m,ysum/n] ;
> end proc:
> A := proc(n)
>         local xymean,n2,lpos,ones ;
>         xymean := {} ;
>         # nxn grid of 1's 2^(n^2) places ennumbered 0..2^(n^2-1)
>         n2 := n^2 ;
>         lpos := {seq(i,i=0..n2-1)} ;
>         for ones in combinat[powerset](lpos) do
>                 {Aaux(ones,n,n)} ;
>                 xymean := xymean union % ;
>         end do:
>         print(xymean) ;
>         nops(xymean) ;
> end proc:
> A(1) ;
> A(2) ;
> A(3) ;
> A(4) ;
>
> --
> Richard J. Mathar https://www.mpia.de/~mathar
>
> --
> Seqfan Mailing list - http://list.seqfan.eu/
>


More information about the SeqFan mailing list