You are not logged in.

- Topics: Active | Unanswered

**Mrwhy****Member**- Registered: 2012-07-02
- Posts: 52

Do I understand you want 4 squares that sum to 130

I must have got summat wrong (as usual!)

The "algorithm" is "Write a program that tries ALL the numbers up to 12 (13 is to big for on its own its square exceeds 130"

Writing the prog takes 60 seconds - running it takes milliseconds.

I assume you want all different integers

How about

1 4 7 8

1 2 5 10

2 3 6 9

and so on

I must have completely misunderstood!

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

Hey, that guy has the same name as you.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

Which guy?

Hi Mrwhy,

What you are twlling me is the brute-force approach, but I need a better approach than that to tackle larger numbers

'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'

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

Hi Agnishom;

I am not finding the error in the code that is leaving out 130.

We could run through your algorithm by hand checking it against mine for each step. Using the 130 as the test number.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

Or maybe running the debugger..

There is only one **Agnishom**. That tumblr. was mine

'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'

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

I know that was you. I was kidding.

You can use the debugger to single step the code.

I am taking a little break, see you in a bit.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**Mrwhy****Member**- Registered: 2012-07-02
- Posts: 52

Agnishom wrote:

Which guy?

Hi Mrwhy,

What you are twlling me is the brute-force approach, but I need a better approach than that to tackle larger numbers

The best method depends on the tools you have!

How big a number

How many milliseconds do you have?

How about all N up to 100,million?

I did not even optimise my search.

What is the point in spending one minute longer writing a better algorithm just to have the prog run in 0.0001 sec instead of 0.001

We can afford MANY seconds - our computers are ever willing ever stupid and ENJOY IT!

EXPERIMENTAL MATHS is FUN - the computer does all the boring bits!

No teeth being extracted at all!

*Last edited by Mrwhy (2013-04-21 08:09:24)*

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

Hi;

What is the point in spending one minute longer writing a better algorithm just to have the prog run in 0.0001 sec instead of 0.001

There is only one really good reason, practice for when you need the skill. Many times problems in combinatorics will have say 20 or 25 factorial different possibilities. Number theory is even worse. You can not always plow through some immense number.

Take this problem which is really about numbers around 40000+ The 130 is just for an example. The simplest approach of 4 loops could require

200^4 checks, that is not an insignificant number. Also, the numbers are getting bigger for what he wants those squares for.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

and my algorithm breaks ten digits number in less than a second, I have checked it.

'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'

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

Do you have an example?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

Of course, give me a number

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

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

I have a nice 9 digit number:

124701084

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

8340, 7426, 2, 2

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

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

Correct a Mundo!

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

*Last edited by Agnishom (2013-04-22 13:43:58)*

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

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

You obviously got it working.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

Is there any specific reason you call it nice?

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

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

Yes, because it can be broken down into squares that are repunits.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

Repunits?

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

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

Numbers with all 1's in them.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

I guess this is much better than Mrwhy's

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

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

Hi;

He has a good point though. A long time ago a very brilliant kid wrote a paper entitled "Commonsense Brute Force and the Computer."

In it he outlined pretty much the same viewpoint.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

Hmm, how was the kid like?

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

'Humanity is still kept intact. It remains within.' -Alokananda

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 83,211

Smart, but very rebellious.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

How did he use to spend his free time?

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

'Humanity is still kept intact. It remains within.' -Alokananda

Offline