Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1801 2012-09-08 02:48:52

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Hi Bobby,

Thanks! smile

Here's my code:

Last edited by phrontister (2012-09-08 05:56:38)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1802 2012-09-08 06:25:59

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi phrontister;


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1803 2012-09-09 15:49:07

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Hi Bobby,

You've probably spotted this already in my M, but sums of any other terms can be found too just by changing the value of 'x'.

I can't remember now what steps I used to get the final M, but it started out more verbose and more logical-looking (to me) until I saw it could be simplified to what it is now. Unfortunately my scribblings are now ashes in the wood heater.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1804 2012-09-09 15:55:49

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi;

It is fine. You could have shortened it just a little.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1805 2012-09-09 15:57:29

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

How, Bobby?


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1806 2012-09-09 16:01:04

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1807 2012-09-09 16:12:06

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Ok, I'll have to think about that.

Yes, I did see that my code would choke on a bigger piece of steak, but as it was able to swallow the tidbit that I fed it I just left it there. No ideas immediately spring to mind, and I don't know where to start looking yet....(maybe I should read the M manual..but I haven't got forever).

Must go...miles of paperwork to do, so I should do it.

Edit: Just saw your edited reply...so that might help. Ta.

Last edited by phrontister (2012-09-09 16:13:27)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1808 2012-09-09 16:13:19

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi;

I modified the above post while you were posting. Work on it a little yourself and then I will show it to you when you get back.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1809 2012-09-09 16:14:50

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

I just saw your edit and edited my post a couple of seconds after your last post. We could cross-post all day long!

Last edited by phrontister (2012-09-09 16:15:51)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1810 2012-09-09 16:20:57

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi;

It is a pain in the neck when that happens.
replace this:

Total[Table[Prime[n], {n, x}]]

with

Sum[Prime[k],{k,1,x}]

I like the way you easily made the jump from Basic's procedural style to the functional style that M supports. It is usually a difficult transition. But in this case M's mathematical style is even better. Sum is equivalent to sigma in mathematics.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1811 2012-09-09 22:44:11

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Hi Bobby,

Yes, that change works well. I tried my code at 80 million but ran out of memory...like you said. Your code found the answer, taking just over 5 minutes.

Thanks for opening my eyes to that improvement. smile

Sum is equivalent to sigma in mathematics.

The only Sigma I know is a Mitsubishi, but I don't think that 'counts'. I looked it up on the net and realise that either I was asleep in class when it was taught or it wasn't taught in my class...or, more likely, I wasn't taught in my class. But then I shouldn't have been reading Thomas Hardy hidden inside my maths book, should I?

I think I follow some of the drift (and I also think that either you or anonimnystefy tried to explain something or other about it to me once), but as I never used that knowledge again, well......you know the rest.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1812 2012-09-09 22:50:55

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Sigma or summation notation is nothing amazing the symbol looks like this:

all that says is starting from 1 to 1000000 put each in k and add em up. You only keep one number in memory.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1813 2012-09-09 23:31:10

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Thanks, Bobby...that's pretty clear.

Now that I see it expressed like that I reckon I was right before in saying that you or stefy tried to teach me something about it.

Btw, I tried to run your code for the 1,000 millionth term, but after 2 hours of blazing effort and nothing to show for it I put it out of its misery.

I guess the larger prime sizes were progressively taking their toll.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1814 2012-09-10 00:13:02

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

There are limits to what can achieved even with modern computers.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1815 2012-09-10 03:05:27

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Maybe I'll flick-pass this over to Scott Flansburg, then. I wouldn't want to overstress my indispensable time-saving device.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1816 2012-09-10 08:21:46

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi phrontister;

Just means that to solve a problem that big we would have to come up with something faster. Anyway, you did well.

But then I shouldn't have been reading Thomas Hardy hidden inside my maths book

I did some of that too. Trouble is you will someday end up on a math forum and have to do it then.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1817 2012-09-10 13:33:07

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Hi Bobby,

Reading the future into the past! Well, then I'd hope to find one with helpful members who know their stuff and can pass it on! smile


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1818 2012-09-10 18:34:28

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hi;

Didn't work out that way for me. Had to do it all by myself. Nothing harder than trying to train an old dog to hunt.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1819 2012-09-10 19:50:39

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Good ol' Tulip turned up its nose when I said I was going to teach it to hunt, with the idea that we would go to Utopia together to track down one of these forums.

I can't hunt without Tulip, so my search is over before it started.

Last edited by phrontister (2012-09-10 21:09:59)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1820 2012-09-10 20:24:13

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Tulip, is that the dog with the cheese?

Wait, I remember now, you said that dog was not Tulip. So, I have never seen a picture of him/her.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1821 2012-09-10 22:05:49

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Ah...the memories! Remember Tu and phro?

Tulip, is that the dog with the cheese?

No, I'm the one with the cheese...and I'm not a dog.

Tulip did this with the cheese...
...which was after having done that to it. Well, something like what that ugly mutt (not Tulip, of course!!) did with the cheese, anyway.

So, I have never seen a picture of him/her.

Neither have I. Tulip is very modest and always declines to have its picture taken.

...him/her.

This answers that gender question.

Last edited by phrontister (2012-09-10 22:07:26)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1822 2012-09-10 22:15:50

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Yes, I remember that but now I am more confused than ever. Unknown gender, no known photographs...


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1823 2012-09-10 23:12:35

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

And well may you be confused: Tulip is one of eleven of the 10 Greatest Unsolved Mysteries of the World. dizzy

Last edited by phrontister (2012-09-10 23:56:16)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#1824 2012-09-10 23:14:45

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: What do you think?

Hmmm. I am still trying to figure out who the heck phro is. Why did you choose that video of that dog?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#1825 2012-09-10 23:40:49

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,804

Re: What do you think?

Hmmm. I am still trying to figure out who the heck phro is.

Me. 'phro' is Tigeree's shortened version of 'phrontister'. See here. Is she a slow typist?

Why did you choose that video of that dog?

That video was the closest thing that I could find on the net to demonstrate what Tulip does in that move. I'd just snatched the cheese from Tigeree and gave it to Tulip for safekeeping. See here.

Tulip and I had perfected a routine whereby I could keep something away from a would-be possessor just by placing it on Tulip's nose, and if that wasn't enough deterrent I'd simply issue a vocal command and with lightning speed Tulip would move its head sideways and catch the object in its mouth...where it would then remain undisturbed until I gave Tulip the command to release it to me.

Works every time...and it was great for keeping the cheese out of Tigeree's clutches!

Last edited by phrontister (2012-09-10 23:47:13)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

Board footer

Powered by FluxBB