Expressing my True Love mathematically and recursively.
This comic calls to mind my Twelve Triangle Numbers of Christmas from way back in 2007.
Once again, I used pseudo-code here, and not any particular programming language. I wouldn't program it exactly like this, but I wanted it to be readable.
As for the summations, those actually caused me some problems -- or at least a bit of thought about how they work, which is something I'll have to refresh my memory on. However, the one thing that occured to me is that I wanted the gifts in order, not just an actual sum of the number of gifts, and I wanted it to match the code. That meant that I had to count backward (or count down). Unfortunately, summations (to my knowledge at this point) count up. That meant minus signs and +1s, which I eliminated by starting j at 0 instead of 1.
More on this tomorrow, probably.
Irregular Webcomic! #2657 Rerun
13 hours ago
2 comments:
I'll grant the summation is not recursive (just mathematical), and I've never heard the term used that way.
But the GIVE routine calls itself with Yesterday's number, all the way down to 1.
my mistake, it's iterative on the outer loop but recursive on the fast wheel of the odometer
Post a Comment