You are not logged in.

- Topics: Active | Unanswered

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

Best to see it with an example.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

bobbym wrote:

You do not have to stop there. When 31 does not work you try 30 which does. Algorithm is very fast.

Hm, okay, that does work. And it is very fast! Constant speed!

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

Hmmm, it is fast but its worst case might be quite slow!

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

bobbym wrote:

Best to see it with an example.

Okay

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

I do not think so.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

Here is one where it works fine:

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

Have you found an example in which it does not work quickly?

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

Heck no, why should I hurt my own feelings?

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

Well, in any case, I think the speed will be sufficient for any number.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

Obviously the algorithm must get there the first time or by continually decrementing find the largest square that would work. But he might now have a problem with the subproblem of 3 squares.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

Oh, yeah, you need to decrement there as well. Can you find an example when the decrement will not work immediately?

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

You mean where you would have to decrement the second one? No, not yet.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

Actually, we need an example where both the first and the second number are decremented.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

Why would we need an example like that?

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

Think about what would happen if only the second number needs decrementing. We could just keep the algorithm running until we get to the second number. We subtract it, the next largest square is the number we started with, all is well. But if both the first and the second numbers need decrementing then running the algorithm to the second number will still need the first number decremented (and it is now the second number).

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

I do not think that is true, at least if I am understanding it. The first two are an ordered pair. They are in >= order.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

Not necessarily. If we need to, we can find the second number first!

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

Before you get the first one?

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

Yes. Imagine that the quartuplet for n is (m,k-1,...,...) and that k^2 is the largest square below n-m^2. Then we won't find anything until we run the algorithm for k-1. Then the next largest square below it is n^2 and we get exactly what we needed.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

The algorithm will run sequentially. It is possible to get an expression for the second square by running it twice symbolically.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

What?

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

The way you can run it with numbers, you can run it with letters. Say n = a; Then the second square according to the recurrence is:

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

Ok, so?

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 94,455

I am not sure but there it is. We were talking getting the second largest square without getting the first weren't we?

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,919

No. I was talking about getting the second number from the answer before the first.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline