[seqfan] Re: An interesting sequence

Robert McKone r.p.mckone at gmail.com
Sun Apr 16 16:25:17 CEST 2023


Thanks for that fix Robert, I have updated my Mathematica code according,
runs a bit slower, but at least it does do a full search now (in my sleepy
mind I thought the average was Sqrt[2n] +1.

a[n_] := a[n]=Module[{x, squares, avg, seq},
  squares = Range[1, Ceiling[(Sqrt[1+48n]-1)/4
  ]];
  For[x = 1, x <= Length[squares], x++,
   seq = Subsets[squares^2, {x}];
   If[MemberQ[seq, _?(Total[#]/Length[#] == n &)], Return[x]]
  ];
  Return[0]
]

On Mon, 17 Apr 2023 at 00:08, <israel at math.ubc.ca> wrote:

> It's worth noting that the average of x distinct nonzero squares
> >= (x+1)*(2*x+1)/6, so x <= (sqrt(1+48*n)-1)/4.
> Here's my Maple program:
>
> T:= proc(x,m)
> # sums of x distinct squares in {1^2, ..., m^2}
> option remember;
>  if x = 0 then return {0}
>  elif m < x then return {}
>  fi;
>  procname(x,m-1) union map(`+`,procname(x-1,m-1),m^2)
> end proc:
>
> f:= proc(n) local S,X,t,x,xmax, tmax;
>  xmax:= floor((sqrt(1+48*n)-1)/4);
>  for x from 1 to xmax do
>   tmax:= floor(sqrt(x*n));
>   if member(n*x, T(x,tmax)) then return x fi
>  od;
>  0
> end proc:
>
> Here are the first 200 terms:
>
> 1, 0, 0, 1, 2, 0, 3, 0, 1, 2, 5, 0, 2, 3, 3, 1, 2, 3, 5, 2, 4, 3, 3, 5, 1,
> 2, 3, 3, 2, 3, 3, 5, 5, 2, 3, 1, 2, 3, 3, 2, 2, 3, 3, 5, 2, 3, 3, 5, 1, 2,
> 3, 2, 2, 3, 3, 3, 3, 2, 4, 3, 2, 3, 3, 1, 2, 3, 3, 2, 4, 3, 3, 3, 2, 2, 3,
> 5, 4, 3, 3, 2, 1, 2, 3, 4, 2, 3, 3, 3, 2, 2, 3, 3, 4, 3, 3, 5, 2, 3, 3, 1,
> 2, 3, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 2, 3, 3, 3, 1, 2, 3, 3, 2,
> 3, 3, 5, 3, 2, 3, 5, 4, 3, 3, 2, 2, 3, 3, 3, 4, 3, 3, 1, 2, 2, 3, 2, 2, 3,
> 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 3, 2, 4, 3, 3, 3, 1, 2, 3, 3, 2, 3, 3,
> 5, 3, 2, 3, 2, 2, 3, 3, 3, 2, 3, 3, 3, 4, 3, 3, 5, 2, 2, 3, 1, 2, 3, 3, 2
>
> Cheers,
> Robert
>
> On Apr 16 2023, Fred Lunnon wrote:
>
> >Ouch --- thanks.
> >Now that blunder is fixed, my brute-force Magma lash-up finds
> >
> >    x = 5  for  n  in  {5, 19, 24, 32, 33, 44, 48, 76} ;
> >
> >    76 = ( 3^2 + 5^2 + 9^2 + 11^2 + 12^2 )/5 .
> >
> >No further zeros up to next standout case at  n = 96 .
> >
> >WFL
> >
> >
> >On Sun, Apr 16, 2023 at 11:23AM <jens at voss-ahrensburg.de> wrote:
> >
> >>
> >> a(11) = 5 since 11 = (25 + 16 + 9 + 4 + 1) / 5.
> >>
> >> Am 2023-04-16 12:07, schrieb Fred Lunnon:
> >> > << only a(2), a(3), a(6), a(8), a(12) are 0 >>
> >> >
> >> > What about  n = 11  ?!     WFL
> >> >
> >> >
> >> >
> >> > On Sun, Apr 16, 2023 at 6:07AM Yifan Xie <xieyifan4013 at 163.com>
> wrote:
> >> >
> >> >> Hi,
> >> >> a(n) is the smallest positive integer x such that n can be expressed
> >> >> as
> >> >> the arithmetic mean of x distinct nonzero squares, or 0 if x does not
> >> >> exist. Based on my calculation of a(1) to a(76) by hand, only a(2),
> >> >> a(3),
> >> >> a(6), a(8), a(12) are 0 and no terms are larger than 5.
> >> >> Please consider this sequence, and if possible, provide a program for
> >> >> me.
> >> >>
> >> >> Best regards,
> >> >> Yifan Xie (xieyifan4013 at 163.com)
> >>
> >>
> >> --
> >> Seqfan Mailing list - http://list.seqfan.eu/
> >>
> >
> >--
> >Seqfan Mailing list - http://list.seqfan.eu/
> >
> >
>
> --
> Seqfan Mailing list - http://list.seqfan.eu/
>


More information about the SeqFan mailing list