On 21 Apr, 14:46, MRAB wrote:
> Trip Technician wrote:
> > Thank you Dave. This does it but slowly. takes every subset of the
> > list a ofsquares, and then gets a 'partition' that will work, many
> > are very inefficient (with lots of 1s).
>
> > any hints
Thank you Dave. This does it but slowly. takes every subset of the
list a of squares, and then gets a 'partition' that will work, many
are very inefficient (with lots of 1s).
any hints about how to speed up ?
def subset(x):
for z in range(1,2**len(x)):
q=bin(z)
subs=[]
although it's not homework (how can i prove that...?) i am still happy
with just hints
+++
we want to express integers as sums of squares. (repeated squares are
allowed)
most numbers have one minimal representation e.g. 24=16+4+4, some have
two or more e.g. 125 = 121+4 = 100+25
so far I have cr
On 20 Feb, 15:39, Nigel Rantor wrote:
> Trip Technician wrote:
> > anyone interested in looking at the following problem.
>
> if you can give me a good reason why this is not homework I'd love to
> hear it...I just don't see how this is a real problem.
>
>
On 20 Feb, 16:02, Paul Rubin <http://phr...@nospam.invalid> wrote:
> Trip Technician writes:
> > I have a dim intuition that it could be done with a very clever bit of
> > recursion, but the exact form so far eludes me.
>
> This sounds a little like a homework assig
anyone interested in looking at the following problem.
we are trying to express numbers as minimal expressions using only the
digits one two and three, with conventional arithmetic. so for
instance
33 = 2^(3+2)+1 = 3^3+(3*2)
are both minimal, using 4 digits but
33 = ((3+2)*2+1)*3
using 5 is no