Sunday, September 6, 2009

A New Perspective on Holidays

I'm just gonna say it. holidays suck when you spend them alone. They really do. Even it being the kickoff of college football this weekend doesn't redeem it. Cause ultimately, it just means you have a lot of time to sit around and think about how alone you are. :-P

I'm kinda hoping I might happen upon an invitation somewhere at church today. I know that's shameful...but what can I say?

In other news...MD disappointed me more than I expected. What the heck is up with Georgia's offense coughing up the ball and not being able to put any points on the board? And Oklahoma...I know you were playing without one of the best QB's in the country, and without an excellent receiver...but you should have been able to put BYU away. That's shameful. And finally, VT, I KNOW you've got more offense than that.

Friday, September 4, 2009

Need To Know

Here at Reason, we do our part to provide you with all the information that you need to know to live a happy, successful, and rewarding life. Here's a word for today, or rather, the number for today. This is the first number that is evenly divisible by every number from 1-10,000.

57933396702876429686922708791662400986348602979985188253931383511489793001457731823088325981761829221665744176794023407056559491402467891577328326763021299466843118474637852656831938521549472347971073068161679301705472685236926463387338495220571064420250677315000599457941340849496227227628926493771018264821842230370349640102573492881424317306189569467101495834601991270039918780924506495405797923762205360790652073159333382795670426041033566699342449050309786673681670483369155689567554239898879039744147333971988258061042090970476729293484513072443614795766878726325795854855394491290821167148355514749149683707585283381546153703014210442470318180511906691108325146494219343498899382918018246586609827667470329166012110874981104800415741527586280026737848182673635645872230905234515169611121042867043956727839314198728626274066655467846183343599194761590368608472578398169740111485924046986870714883894285841394964627408094161019230662749101230783008668676907211199488107523306410531772045452853957706873238466829988649822157557103503283563398281775464911904789159515900987401574678885942493907604740891878907698622679570965569483682456042918236444719794534411171907606336090534029349351300276141892529795448751826394399153216183270385737795748770508612096374765333578237973395907265484337502903901947799663388329849198045756207969590055686607678195206367273600632909417024224754750428711236917913663419215925830944035539848749163178489614227546656090790164108195741048033614368495827231281392190063051315248070192263400801315095608512139510731469732311313898995746040563433121427776071482655904346538281010668476731132415829844984600414136781404774213539507859790229205890271721600309169926806121871750008163738773911610009508609149665332579632767397078877996926581337419351834754370411008686136818501030862345505385357198060894463821342298717851567836562984344806469613768024764967372979655179066074398198246805104576134474823016488842818077041661676098399378809713894284994865370648616800689225595431967181072865363430005250840767890912164530705704936837915584856606960687347372391339254432119085932175541392954343684716695162629271229789289404752104218596977036941910521266321726821940533986384237994403780618301379099347975260122724194454275088825587044488208965690373706904056926509324696308810974331790119456438147168585552011926921912167450509941646104076818762060881903969616431646384985895944231218505620547093874241169759205450145478746112796898626711966320965057212219958567338851356631739947125096250452942497473309299907612330435197454392788637359253116308685007014249605492659524429134513344137517101872279428202285951652856354827230765931502805341696470148698002737700823078904634554776750169178259216255903968865588749827789888950172452455448248833712309835657561369233157977405579365293671943131412034109901944892819245001657496671822581274180596255340507054499934060282320458240722454209933569735940032859109934686878274110864394924463573852015338428881961843292083566034669814619612606638283615766521897504566616272305253931938372830446073384019299355320864342734019517633662346790422915951954822645137091494126100390104510987373366328615363056042137440808225973600809566845718073791616927784260557845021823094999326904373592319407516660896764388092262510369182153559285446074990941863516247226532653142198551840063631989428776799533286215464660644129411503287306838551341184739976807097763115368031748646043780549055143428297230678053738453010234949008253769355207208167999203353157524666017029803679612131824740794652592875662818479980117505768541194835524231818203552256426752730455115752280837099763237606348192867936457993970866446264015812819179994138642295108872381709181937092290392544335464025324661284746003660247161196698209062164637264114930766444473471083408200329662059064201896721165015687487728300854501780810155844837489798144309942999091774466406270065305461848242329380636274754660519867343112275861821293501112101434868225378041813836808745417606289159904294165941408692922250601127804971962342807927743390030395048263275616935165347620718001157478088456439083590834464409622781693790883289597024043982584220069224170235863458745344365684082114430362867446193601075569803650773018026700003812298460527976219100308016537538008597751565631582745643139434508332515569645426771080000093248326671232352303901422

my program took 52.403000 seconds to compute, which i was pretty proud of.

The original problem was to find the smallest number divisible by 1-20, but aftter realizing that my program solved that in less than .5 microseconds (0.000000 sec) I decided to test how fast it actually was. 1-100 it was still registering a flat 0 seconds. 1-1000 it came in at 0.125. The calculation for 1-100,000 I left running over the weekend at work. no idea if it's solved it yet. but if the time increase is exponential, as it appears to be, I'm guessing not. I'm also somewhat curious what python's limit is on the size number it can handle. just to give you a perspective on how big that number is, a lower limit estimate of the number of atoms in the universe is ~3x10^79. I should have just checked the string length in python, but I forgot to. However, that number is on the order of 6x10^4000.

So that's if for today, and remember, you are a really, REALLY tiny insignificant part of a BIG universe, and yet God knows every hair on your head. how about that, eh?

Code is written in python. I'm not actually positive this is correct...cause I was just trying to remember it here, but it's pretty close. I'll check it when I go to work on tuesday.

n=10000 #Establish search boundary
c1 = c2 = n #Establish dummy variables
for n range (n+1, 1, -1): #Establish range
while c1%n != 0 : #I only pretend I know what I'm doing
c1 = c1+c2 #If you actually read all my comments, you'll realize I am NOT a "real" programmer
c2=c1 #But it's fun anyway
print 'The smallest number divisible by 1-', n, 'is', c2, '.' #Booya baby

The key to this program is recognizing the following. Assume you have a number "a1" that is divisible by "b" and "c", and you want to find the next smallest number, "a2" that's also divisible by "d". By necessary consequence:

a2 = a1+x*a1
where x is a positive integer. The easiest way to convince yourself of this is to realize that since the a1 component of a2 is divisible by b and c, the a2-a1 component must also be divisible by b and c. And since we just stated that a1 is the smallest integer evenly divisible by both b and c, a2 must be some integer multiple of a1. So each iteration of the while loop simply adds another value of "a1" and checks to see if the new number is divisible by the current number in the for loop.
The only other "trick" is to start at the top rather than the bottom. This makes your convergence much faster, since you are working in much larger steps right off the bat. In fact, the program converged to the solution for 1-20 in 81 iterations!

Enjoy!