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

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

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.No great discovery was ever made without a bold guess.

Re: What do you think?

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.

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

Re: What do you think?

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