General problem

Announcements, comments, ideas, feedback, and "How do I... ?" questions
Post Reply
BioZ
Posts: 1
Joined: Mon Nov 17, 2008 8:50 pm

General problem

Post by BioZ »

Hi,
Since last week I'm 'playing' with projecteuler problems. At first I thought that it's for pure geeks. Now I think it's quite nice thing to train mathematics and programming(or am I a geek??). But there is a little problem.
I have solved problems 1, 2 and 6, and tried to solve 3, 5, 10 and 20(now I'm thinking about 9). But...
My PC doesn't handle this;/.
I use Octave(Matlab clone), when I try to make algorithm to work with things given in examples, it works, but when I try to do things that I should...
Problem 3: number 600851475143 is too big - could I somehow change type of variable?
Problem 5: my computer is working ~3sec. to find number divisible by numbers from range 1-10, ~13 when the range is 1-11, and... when I set range 1-20, after 1,5h of waiting I just turned it off, depressed that my pc is so slow.
Problem 10: the same problem as above.
Problem 20: 100! is too big, the same problem as in #3.
What can I do? These are one of the easiest problems, and I can't solve them:(!
My pc's most important parameters: Athlon 64 3000+(1,8GHz; but Windows XP is 32b), 1024MB RAM.
I have also a notebook with 2048MB RAM, and the cpu is similiar(Dual Core ~1,8GHz, 32b), but I don't know what to do when Octave uses only one core even trying to solve problem 5 or 10.

Looking forward for answer and thanks for every help, I'm total noob for now x]...
Greetings,
BioZ.
User avatar
hk
Administrator
Posts: 12831
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: General problem

Post by hk »

re problem 3: you should use the uint64 datatype. See also http://www.gnu.org/software/octave/doc/ ... Data-Types
In fact the problems you try to solve can be solved with every computer. They were thought up years ago when nobody had ever heard of dual core processors.
So you should reconsider your methods or change to some general purpose programming language.

If you read http://www.gnu.org/software/octave/doc/ ... Arithmetic it will show you some behaviour of Octave which will make it almost impossible to solve some of the higher numbered problems so it is better to change to a general purpose programming language.
Image
War ruins the life and health of untold numbers of innocent children.
Post Reply