Comments on: What is the largest prime factor of the sum of the favorited comments from all fibonacci-numbered MeFites?
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites/
Comments on MetaFilter post What is the largest prime factor of the sum of the favorited comments from all fibonacci-numbered MeFites?Mon, 13 Oct 2008 03:37:24 -0800Mon, 13 Oct 2008 03:37:24 -0800en-ushttp://blogs.law.harvard.edu/tech/rss60What is the largest prime factor of the sum of the favorited comments from all fibonacci-numbered MeFites?
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites
"<a href="http://projecteuler.net/">Project Euler</a> is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems."<br><br>Started in 2001 as a sub-section of <a href="http://mathschallenge.net/">Maths Challenge</a>, it has since grown large enough to become its own entity. It now boasts over 200 problems, many of them insanely difficult. <br /><br />"Each problem has been designed according to a "one-minute rule", which means that although it may take several hours to design a successful algorithm with more difficult problems, an efficient implementation will allow a solution to be obtained on a modestly powered computer in less than one minute."<br><br><a href="http://www.metafilter.com/44441/Euler-I-never-even-met-her">Previously</a> (Aug 2005)post:www.metafilter.com,2008:site.75614Mon, 13 Oct 2008 03:34:40 -0800mystykalgorithmschallengemathprogrammingtimesinkBy: mystyk
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296530
I've been working at it for about six hours over the last two days, and I've only solved 15 out of a current 212 (7%).comment:www.metafilter.com,2008:site.75614-2296530Mon, 13 Oct 2008 03:37:24 -0800mystykBy: HaloMan
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296539
It's a great site, but <a href="http://www.metafilter.com/44441/Euler-I-never-even-met-her">this is a 3-year-old dupe</a>.comment:www.metafilter.com,2008:site.75614-2296539Mon, 13 Oct 2008 04:16:16 -0800HaloManBy: twoleftfeet
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296543
Not entirely a dupe. It's gone from <a href="http://web.archive.org/web/20050829192944/mathschallenge.net/index.php?section=project&ref=view">102 problems</a> to 212. And it has its own domain instead of being linked from the Maths Challenge home page.comment:www.metafilter.com,2008:site.75614-2296543Mon, 13 Oct 2008 04:29:49 -0800twoleftfeetBy: mystyk
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296550
Apparently the prominently placed "Previously" was too well hidden. Besides, even if it hadn't changed at all, that's still over three years worth of users who never saw it and may find it as entrancing as I do. I actually had it in my old bookmarks from back then, in the "I'll get around to it someday" pile, and I'm glad I finally did.comment:www.metafilter.com,2008:site.75614-2296550Mon, 13 Oct 2008 04:42:52 -0800mystykBy: DU
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296559
I worked on Project Euler for several weeks a couple years ago. It looks like I got 62 of them. They've done a good job of posing problems that can't be solved by direct analytic methods OR naive brute force ones. You need to figure out some heuristics or some way to reduce the problem, then an elegant brute force search.
At least that's what I always had to do. I eventually had to stop because the remainder (at the time) started requiring more and more number theory (which I lack) and less and less naivete (which is my strong suit).comment:www.metafilter.com,2008:site.75614-2296559Mon, 13 Oct 2008 05:41:53 -0800DUBy: HaloMan
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296616
Hm. You have a point - sorry for being an ass.comment:www.metafilter.com,2008:site.75614-2296616Mon, 13 Oct 2008 07:10:26 -0800HaloManBy: adipocere
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296619
If only the Python Challenge was framed in such a direct manner ...comment:www.metafilter.com,2008:site.75614-2296619Mon, 13 Oct 2008 07:15:43 -0800adipocereBy: srboisvert
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296666
Is it wrong that as that as soon I saw Project Eular I started thinking <a href="http://www.youtube.com/watch?v=0s-oGumvPz0&feature=related">"Eular........Eular........Eular......" Anyone... Anyone?</a>comment:www.metafilter.com,2008:site.75614-2296666Mon, 13 Oct 2008 08:18:30 -0800srboisvertBy: mystyk
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296669
I doubt any of us <i>didn't</i> have that thought. I tried to come up with a variant that would be clever for use in the post title, but you just can't recreate the magic of that moment.
(I'm a firm believer that that was the first, last, and only good line Ben Stein ever had. Now he just runs around saying nonsense. "Evolution - there's a Visine for that...")comment:www.metafilter.com,2008:site.75614-2296669Mon, 13 Oct 2008 08:24:29 -0800mystykBy: Wolfdog
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296672
<i>Is it wrong that as that as soon I saw Project Eular I started thinking "Eular........Eular........Eular......" Anyone... Anyone?
</i>
Yes, there are at least two distinct things wrong with that.comment:www.metafilter.com,2008:site.75614-2296672Mon, 13 Oct 2008 08:26:22 -0800WolfdogBy: burnmp3s
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296749
I heard Euler had a <a href="http://en.wikipedia.org/wiki/Houston_Oilers#Houston_Oilers_era_.281960-96.29">football team</a> named after him at one point.comment:www.metafilter.com,2008:site.75614-2296749Mon, 13 Oct 2008 09:50:02 -0800burnmp3sBy: DU
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296810
I never though Euler Euler Euler. It's pronounced "Oiler".comment:www.metafilter.com,2008:site.75614-2296810Mon, 13 Oct 2008 11:00:47 -0800DUBy: iconjack
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296838
Which ones are insanely difficult?comment:www.metafilter.com,2008:site.75614-2296838Mon, 13 Oct 2008 11:43:26 -0800iconjackBy: Perplexity
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296852
ooh this is fun.comment:www.metafilter.com,2008:site.75614-2296852Mon, 13 Oct 2008 12:22:11 -0800PerplexityBy: musicinmybrain
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296853
<i>Which ones are insanely difficult?</i>
None, I guess, if you've already figured them out, or perhaps if you solve this sort of problem for a living. But look at something like <a href="http://projecteuler.net/index.php?section=problems&id=202">Problem 202</a>: the challenge is in finding the way to reduce an apparently intractable problem to a solvable one. For a lot of problems, that can require some pretty significant persistence and insight.comment:www.metafilter.com,2008:site.75614-2296853Mon, 13 Oct 2008 12:23:05 -0800musicinmybrainBy: kaibutsu
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296863
Hm. This looks like fun. <a href="http://projecteuler.net/index.php?section=problems&id=15">Problem 15</a> doesn't require a computer; it's one I happen to know off the top of my head. Though I guess I would need a calculator to get the actual numerical value.
I would probably waste a bunch of time on this if I didn't have to study for quals...comment:www.metafilter.com,2008:site.75614-2296863Mon, 13 Oct 2008 12:38:10 -0800kaibutsuBy: lupus_yonderboy
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296896
Hah, I already identified 202 as the only really hard one.
These are fun problems though. Let's see how long problem 211 (taken at random) takes to solve...comment:www.metafilter.com,2008:site.75614-2296896Mon, 13 Oct 2008 13:49:54 -0800lupus_yonderboyBy: lupus_yonderboy
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296915
I wrote a fast, unoptimized version to make sure I knew what was going on... this will take days to complete however (if that, it slows down quadratically as it goes).
Back to (real) work for me. I'll make it work reasonably fast (if I can) and report later. (This is really for my own interest only :-D).
There are some clear tiny optimizations but I think you can get a massive speedup with a recurrence relation....comment:www.metafilter.com,2008:site.75614-2296915Mon, 13 Oct 2008 14:28:38 -0800lupus_yonderboyBy: aspo
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296924
Project Euler is one the first places I go when I'm learning a wacky new computer language. It's a great way to figure out how to write clean, reusable code (a lot of problems build on the tools used in earlier ones) and how to translate basic algorithm into that language's favorite idioms.comment:www.metafilter.com,2008:site.75614-2296924Mon, 13 Oct 2008 14:44:11 -0800aspoBy: Perplexity
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296946
Hmm, Problem 14 is messing with me. I used a brute force approach and came up with 992283 as starting the longest chain, with 501 steps. I'm pretty confused as to what I could be doing wrong. Any suggestions? Or maybe someone could identify a number that starts a longer chain? I'm baffled.comment:www.metafilter.com,2008:site.75614-2296946Mon, 13 Oct 2008 15:11:22 -0800PerplexityBy: Perplexity
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2296966
Aha, I was overflowing my float; had to use double.comment:www.metafilter.com,2008:site.75614-2296966Mon, 13 Oct 2008 15:31:29 -0800PerplexityBy: flatluigi
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297028
<em>What is the largest prime factor of the sum of the favorited comments from all fibonacci-numbered MeFites?</em>
Is anyone taking a stab at this?comment:www.metafilter.com,2008:site.75614-2297028Mon, 13 Oct 2008 16:23:35 -0800flatluigiBy: Hello Dad, I'm in Jail
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297033
Why does that guy have crumpled up underwear on his head?comment:www.metafilter.com,2008:site.75614-2297033Mon, 13 Oct 2008 16:25:38 -0800Hello Dad, I'm in JailBy: lupus_yonderboy
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297050
(Had a few minutes later). So I have the "trick" to that one 211 - but Python (which was what I was prototyping in) is too slow to pull it off unfortunately within the 10 minute time (based on my estimate).
Spoiler hint: if p is prime and has no common factor with q, what's f(pq)? What's f(ppq)? ("f" being the sum of the squares of the divisors). Use induction to get a formula based on the prime factoring and make a table of all of them.comment:www.metafilter.com,2008:site.75614-2297050Mon, 13 Oct 2008 16:37:56 -0800lupus_yonderboyBy: lupus_yonderboy
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297082
And I had a point to this. :-D That being that these are nicely tricky, attainable problems which are still honestly hard.
I just did #14 and I didn't get the same results you did. It was quite easy.
I got: (837799, 525)
<pre>#!/usr/bin/python
def Next(n):
if n % 2:
return 3 * n + 1
return n / 2
def FindLongestChainIndex(max_num):
# Cache results in a dictionary!
chain_length = {1:1}
max_chain = 0
max_length = 0
def GetChainLength(x):
if x not in chain_length:
chain_length[x] = 1 + GetChainLength(Next(x))
return chain_length[x]
for i in range(2, max_num + 1):
length = GetChainLength(i)
if length > max_length:
max_length = length
max_chain = i
return max_chain # , max_length, chain_length
def GetChain(x):
if x == 1:
return [1]
return [x] + GetChain(Next(x))
def GetLongestChain(x):
return GetChain(FindLongestChainIndex(x))
longest_chain = GetLongestChain(1000000)
print longest_chain[0], len(longest_chain)
</pre>
Runs in 5 seconds on my pretty fast Mac.comment:www.metafilter.com,2008:site.75614-2297082Mon, 13 Oct 2008 17:12:15 -0800lupus_yonderboyBy: lupus_yonderboy
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297083
ARG, what happened there!? It looked great on the preview pane!
So sorry, mods, any way to fix?!comment:www.metafilter.com,2008:site.75614-2297083Mon, 13 Oct 2008 17:12:57 -0800lupus_yonderboyBy: mystyk
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297467
I really enjoyed #18. Once you figure out the bottom-up approach instead of a path-search, you reduce the time from O (2^n) to O (n^2). Plus, you can re-use that solution on #67, where n becomes 100.
Strangely enough, I can't get #17 to work. "If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?"
I've written and re-written the program, using strings sometimes and just adjusting counters other times, accounting for use or non-use of "and", and even worked it out on paper. It's not accepting the answer.comment:www.metafilter.com,2008:site.75614-2297467Tue, 14 Oct 2008 05:00:11 -0800mystykBy: dixie flatline
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297534
All I can say is the harder problems here are definitely difficult enough for me. I discovered the site about 6 months ago, and I've solved about 150 of the problems. The ones that remain are pretty tough.
You can sort the problems by "difficulty", meaning how many people have solved them. Most of the ones that have been solved by fewer than about 500 people are tough as far as I'm concerned.
By the way, claims that they're all extremely easy will be more credible if you make them after having solved the problem rather than before :) (keeping in mind that your solution is supposed to run in less than a minute.)
If anyone wants hints on some of the earlier problems you can MeMail me. Don't think I want to post spoilers and solutions here.comment:www.metafilter.com,2008:site.75614-2297534Tue, 14 Oct 2008 06:30:47 -0800dixie flatlineBy: ymgve
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297652
For those that use Python to solve the problems and find it too slow for certain tasks, take a look at <a href="http://psyco.sourceforge.net/">Psyco</a>, a JIT-like compiler. Very easy to use (Just install, then add one line to your source gode) and gives significant speed improvements.comment:www.metafilter.com,2008:site.75614-2297652Tue, 14 Oct 2008 08:32:23 -0800ymgveBy: lupus_yonderboy
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297777
I don't think anyone would claim that any of the problems are extremely easy. #14 was pretty easy. I spent the better part of an hour on 211 but didn't generate a solution that runs close to the time limit.
I spent about 10 minutes thinking about 202 and aside from the <b>lightbulb</b> OK, I guess I do now know how to do 202 :-D but I'll bet it'd take work to get it right!
These are <i>good</i> problems - clear goals, interesting solutions that aren't trivial but are attainable. They're good at two levels: it takes "mathematical maturity" to see the right approach - but then if someone tells you the right approach, the implementation is also entertaining and challenging. And none of them are insanely hard.
In Knuth's "Art of Computer Programming", the exercises are marked as to their level. Some of them are fairly easy - I believe some still remain unsolved thirty years later. That's insanely hard.
He references some other text which did this, except it didn't even mark the difficulty level. :-Dcomment:www.metafilter.com,2008:site.75614-2297777Tue, 14 Oct 2008 09:45:02 -0800lupus_yonderboyBy: kaibutsu
http://www.metafilter.com/75614/What-is-the-largest-prime-factor-of-the-sum-of-the-favorited-comments-from-all-fibonaccinumbered-MeFites#2297832
Another (in)famous source for problems is Stanley's <a href="http://math.mit.edu/~rstan/ec/">'Enumerative Combinatorics.'</a> He marks his problems on a 1-5 scale (with +'s and -'s). A [3-] is the hardest problem that can reasonably be assigned as homework; [5]'s are unsolved. He famously has a 66-part problem in which the answer to every part is the Catalan Numbers, expanded to 200+ parts on the website linked above.comment:www.metafilter.com,2008:site.75614-2297832Tue, 14 Oct 2008 10:21:37 -0800kaibutsu