Using Fibonacci numbers to convert from miles to kilometers and vice versa
catonmat.net
catonmat.net
This is aways possible, see Zeckendorf's theorem.
The Wikipedia entry does suggest a greedy algorithm (at each step choosing the largest fib number that fits) though, using that we have
121 = 89 + 21 + 8 + 3
In other news, π² ≈ g.
"Zeckendorf's theorem states that every positive integer can be represented uniquely as the sum of one or more distinct Fibonacci numbers in such a way that the sum does not include any two consecutive Fibonacci numbers."
so, distinct and non-consecutive
What if a sum has more than 2 consecutive Fibonacci numbers? That doesn't cause a problem, but it takes a little more work to sort it out.
It looks like non consecutivity is only there to force unique solutions hence called zeckendorf representations
PDF link: https://www.sliderulemuseum.com/SR_Class/OS-ISRM_SlideRuleSe...
A combination of both the fundamental theorem of algebra and Zeckendorf's theorem has allowed me to fill in the rest so far. For example, 25 mi = 5 * 5 mi, which yields 5 * 8 km = 40 km. As it turns out, that is how far Cleveland, TN, lies from Chattanooga.
How do you apply the fundamental theorem of algebra here?
I memorized this almost by accident. I was doing hand rolled spaced repetition system for conditioning myself to fix some bad habits, and they came up often enough that it was memorized.
I mean it is possible that gradual point drift would get there. But sufficiently improbable that I know what I'm betting on.
So it becomes 1 2 3 5 8 13 20 40 inf ?
Now to convert from miles to km replace a multiple of 10 by a multiple of 16. 70 mph becomes 112 km/h.
To convert in the opposite direction do the opposite. 130km/h is 128 km/h + 2 km/h = 80mph + 1 mph (rounding down since you don't want to have to justify this calculation at the side of the road, to a gendarme, in a foreign language).
1.6 km = 1 mile is just as accurate as using 1.618.., the golden ratio. (Enough for driving, not enough for space travel.) And using the Fibonacci method is less accurate than the golden ratio since small Fibonacci numbers are only approximately the golden ratio apart.
The only possible justifications for the Fibonacci method are:
1. You want people to know that you know what the Fibonacci sequence is.
2. You enjoy overengineering.
3. You're one of quite a few people who believe, for whatever reason, that the golden ratio appears all over the place like in measurements of people's belly buttons, the Great Pyramids, and so on, and that this has some spiritual or mathematical significance.
I consider any distance reachable with one tank of gas commonly used (so up to 400 miles).
Take your kilometres e.g 60, divide by 5 -> 12, now times that by 3 -> 36.
Take your miles e.g 80, divide by 5 -> 16, times 8 -> 80 + 48 -> 128
So any conversion reasonable conversion can be done in your head with your 3, 5, and 8 times tables
On a recent trip, I was driving in Canada in a car bought in the United States that did not have the metric values on the speedometer. But all of the posted speed limits were in values of 5 kph. Once you get that (roughly) 100 kph = 62 mph and 10 kph = 6 mph, there are some simple quick divisions or subtractions to convert the speed limit to close enough.
- 50 kph = (100 kph) / 2 = 62 mph / 2 = 31 mph
- 80 kph = 100 kph - 2 * 10 kph = 62 mph - 2 * 6 mph = 50 mph
Both of your examples are actually easy Fibonacci numbers.
50kph - 5 is a fib number, and the previous number is 3. I can go 50->30 without any math at all.
And 80kph, well 8 is also a fib number. And the previous is 5. I can go 80->50 without any math at all.
120kph is close to 13, so I know 120kph is somewhere below 80mph. I always divide any remainder by 2, so I would quick math my way to 120->75. That's accepatably close to the real answer of 74.4
Same thing with 110kph. That's close to 13, so I'd quick math to 70 mph (130->80, remainder is 20, subtract half the remainder). That's acceptably close to the real answer of 68.2
Also, this doesn’t only work with Fibonacci numbers, it works with any Lucas sequence, since they all tend to phi, so as well as 2-3-5-8-13 you can also use the higher numbers from 1-3-4-7-11 to fill in some gaps and help estimate.
And as a bonus, it means if you know A kph is equal to B mph, you also know that A mph is ~equal to A+B kph.
So given your result above of 120kph=74.4mph, I would estimate 120mph≈194kph. And it turns out it’s actually 193.1koh, so… not far off.
To divde by 1.6, multiply by 10, then divide by 2 4x. Eg : 200 kph, 2000, 1000, 500, 250, 125 mph
Regularly needing to translate between sane units and US (and occasional British) idiosyncrasies keeps these mental muscles worked enough that it's mostly subconscious now.
I didn't enjoy rote repetition of times tables and drills as a kid, but it's frustrating seeing my daughter being taught to understand multiplication, and learning "strategies", but struggling with mental arithmetic (I mean she tests above grade level, so I'm not worried, it's just a _get off my lawn_ reflex)
I don’t think knowing all the times tables up to 12 is as helpful as having a good appreciation for how to break a multiplication into simpler parts, but you do need immediate recall on multiples of all the single digit numbers, up to at least times five or six.
Yes, this means both 90 and 100 km/h both covert to 60mph. Close enough!
So the km:mi ratio is somewhere between 60:100 and 66:100. I choose whichever one makes sense depending on the number in front of me.
- the first published use of the term “golden section” (which later became more commonly known as the “golden ratio”) to describe the number phi[1] was by Martin Ohm, the brother of Georg Ohm who the unit is named after.
- Binet’s closed form series solution for the Fibonacci numbers[2] is really cool because it involves three irrational numbers yet every term of the resulting series is of course an integer.
[1] (1+sqrt(5))/2
[2] F(n)=(phi^n - psi^n)/ sqrt(5) (n=0,1,2,…) where phi=(1+sqrt(5))/2 and psi=(1-sqrt(5))/2
In your head you can multiply or divide by two four times and move the decimal point once when it's most convenient or best facilitates further multiplication or division.
How many km in 100 miles? 100/5 = 20, 20 * 8 = 160.
How many miles in 400km? 400/8 = 50, 50 * 5 = 250.
And 8/5 is 1.6 exactly, which is close to the "golden ratio".
* There are occasional places where private property has speed limits with weird factors, but they're so rare as not to worry about. (the one example I remember is when I used to cycle to work and took shortcuts through a sewage plant that had an '11 mph' speed limit, why? who knows.
(You won't get results as accurate as that suggests, of course, because doing the Zeckendorff + Fibonacci-shift thing only gives you an approximation to multiplying by (1+sqrt(5))/2.)
They also mention _approximate_ cm/inch conversion is doable by double shift on the Fibonacci scale - if golden ratio was exactly 1.6, its square would be 2.56, but actual phi² = 2.618 which is quite bad approximation for 2.54...
I once worked out a way to quickly figure sales tax for my area using just a small number of operations that are easy to do in my head.
"Easy" means that it just involved things like taking 10%, or multiplying or dividing by 2, or adding or subtracting, or rounding to a given precision, and that it did not require keeping too many intermediate results in memory.
It worked great. And then the sales tax rate changed.
I have a vague recollection of then writing a program that would brute force check all short combinations of my "easy" operations to find ones that worked for a given tax rate. But I can't find that program now, and may have only thought about writing it.
Doesn't work if you are trying to decide if you have enough change to buy something of course.
fn(n miles to km) ≅ next_fib(n)
fn(n km to miles) ≅ prev_fib(n)
---
Similarly,
fn(n kg to lbs) ≅ prev_fib(n) + next_fib(n)
fn(n lbs to kg) ≅ (prev_fib(n) - prev_fib(prev_fib(n))) * 2
fn(fib(i) lbs to kg) ≅ fib(i-1) - fib(i-4) # Alternate formula
I usually just treat miles as kilometers. When I need more precision I multiply miles by 1.5. All these 8/5 just don't stick in my mind, and 1.6 is not much better then 1.6, but it is much easier to multiply by 1.5.
> And how often does one need to do this conversion anyway?
Every time I see distance measured in miles. It may be 1 time per week, or multiple times per day.
I'll take "things not to say to a cop" for 300 Alex.
There, did it in O(1)
In other words, your algorithm is asymptotically too fast and you failed the interview! :D
That said a fixed-factor mutiplication can probably be done faster AND [more] precisely as a sum of some shifts. Or many other ways with a lookup table.
I wasn't able to for miles to kilometers, but for pounds to kilograms I got:
a_n = a_{n-1} + 4*a_{n-2} - 3*a_{n-3}
Converges (slowly!) to a ratio of 2.199, so you can then take the previous term of the sequence to convert from pounds to kilograms.
However, this can get confusing it it get's to odd numbers etc, so what you can do is, simple leave it as miles because if you are in a miles country no one is converting it to km or vice versa.
Same with C and F in temperatures, there are basic maths systems that can do this in constant time, so there is no real reason to complicate it unless you want to do it in your head and then there is the basic maths to do it, if you can't just use a calculator.
My relatives & friends visiting from Europe often appreciate knowing such values in km/C. There are various other reasons to want to do the conversions too, and sometimes speed > accuracy. It's a bit ridiculous to think that _no one_ is doing these conversions and that shortcuts/approximations like this are not useful.
Maybe true in a miles country, I'm not sure.
However, so much stuff posted on the internet just assumes you are from the states, so they use imperial measurements only, and most of the rest of the world does need to do these conversions. I'm converting on an almost daily basis.
If you need to do rough conversions just think of a kilometer as slightly more than 3/5ths of a mile.
I can confidently assure you that right about now there are a bunch of Europeans reading your message multiple times, trying to figure out what 3/5ths of a mile even means, asking themselves if this is satire.
A kilo meter is 1000 meter like a kilo gram is 1000 gram.
A land mile is 1609.344 meter.
16 is easy to remember as a symbol of immaturity but you do get to drive in the us. Not in the eu nein
Wow, I didn't think of poor imperial kids, that are definitely forced to remember all these numbers. But now I'm really sorry for them.
$ factor 5280
5280: 2 2 2 2 2 3 5 11
2^5 and 5 is nice, 3 can be tolerated, but 11? Who in their right mind would come up with something like this? Why not just round it to 5000?It's not like you often have to do math with them, outside of school math problems. A year isn't precisely 365 days, and months are all different lengths. It's just more of the same type of thing; doesn't actually cause problems when distances are usually expressed in miles anyway.
The system is not meant for units to be converted.
100km==60miles 80==50 50==30
It helped that that also covered most of our posted speed limits - the US with its penchant for speed limits ending in 5 would find it harder going
Is it really just a coincidence? Genuinely curious.
The kilometer: As part of the widespread rationalization that occurred during the French revolution, the meter was defined in 1791 as 1 ten millionth the distance of a line drawn from the equator to the north pole, through Paris.
Golden ratio: 1.618... km / mile ratio: 1.609...
So, seems like just a coincidence.
But these are fun:
https://en.wikipedia.org/wiki/Mile https://en.wikipedia.org/wiki/Kilometre
Rationalized but nearly unrealizable.
The kilometer is a thousand meters of course. And a meter was defined the way it was to match the length of a pendulum with a period of 2 seconds.
The mile was defined the way it was to match a different thousand: a thousand Roman paces, measured as two steps. (They didn't like the fact that if you go from left foot to right foot the measurement is slightly diagonal, so they measured from left foot to left foot.) So if you figure that a Roman had a leg length, measured from the ball of the hip joint to the heel, say, as 80cm, and you figure that they marched like equilateral triangles, then the full pace is about 160 cm or 1.6 m, and the Roman mile is then ~1.6 km.
But, my point is, these two numbers are not totally disconnected like it seems at first. So the second is a precise fraction of a day which has no direct connection to a person's leg. But, the decision to use this precise fraction is in part because when someone was looking at the 12 hours on the clock and placed the minutes and seconds, 5 subdivisions of the 24th part of the day looked and "sounded right." It is somewhat likely that this in part sounded right due to the standard Roman marching cadence, which was 120bpm (between footsteps) or 60bpm (left-foot-to-left-foot), set by your drummer, chosen presumably to maximize average efficiency among the whole unit.
So then if we treat everyone's legs as a pendulum that is being driven slightly off-resonance, then the period of this leg motion is ~1 second and the leg behaves like a pendulum that is ~25cm long. And this kind of tracks! Measuring from the hip socket down 25cm gets near most folks' knees, the thigh is heavier than the calf so one would expect the center of mass to be up a little from the kneecap.
So then you get that the leg is 80cm long from hip-socket to tip, but 25cm long from hip-socket to center-of-mass, and so you get some pure geometric ratio 2.2:1 that describes the mass distribution in the human leg, and that mass distribution indirectly sets the 1.6 conversion factor between km and miles.
If we could only connect the human leg's evolutionary design to the Golden Ratio! Alas, this very last part fails. The golden ratio can appear in nature with things need to be laid out on a spiral but look maximally spread out given that constraint (the famous example is sunflower seeds), but all of the Vitruvian Man and "the golden ratio appears in the Acropolis" and whatever else aesthetics is kind of complete bunk, and there doesn't seem to be any reason for the universe to use the golden ratio to distribute the mass of the muscles of a leg. So you get like 98% of the way there only to fail at the very last 2% step.
Increase by 60%. That's how I do it.
Now I'm waiting for something that cool for Celsius and Fahrenheit...
Also, this should be (2010). The "last updated 3 weeks ago" is likely not real at all, every page on this blog was allegedly updated in a similar timeframe. (Maybe it counts every change to the list of links? Or maybe it's just bogus SEO nonsense.)
Meanwhile, they're making some dubious claims about the security and privacy of their cloud browser service. Sure, your ISP might not see which websites you're visiting on it, but now they can go snoop on your browsing however they'd like, and read off all your passwords and whatnot.
This doesn't have any particular implications for this particular page, and the "lucky 10,000" who had never before encountered the idea of converting between miles and kilometres using Fibonacci numbers will have learned something fun, which is great. But seeing the SEO bullshit tells me immediately that I am not going to want to (e.g.) add this blog to my feed aggregator[1].
[1] Does anyone else actually use these any more? I feel a bit of a dinosaur.
The grandparent of this comment was useful to me. Your "why be a hater?" was not.
If you don’t see the hate in statements like that, I question your empathy. What would be wrong with talking about the actual content in the article?
For all you know, the author downloaded a theme and doesn’t care in the slightest. But you don’t have enough empathy to consider that so you’ll close your mind to what could potentially help you think differently.
Hate over stupid things is remarkably boring. Deal with facts - they’re helpful.
I am curious as to whether you truly think that
> Those are some amazingly spammy "Top Posts" at the bottom of the page.
shows more hate and less empathy than
> But you don't have enough empathy to consider that so you'll close your mind to what could potentially help you think differently.
It seems the other way around to me, though of course my opinion will be biased by the fact that one of them is being negative about me and the other about the maker of some random blog on the interwebs. (Though ... I tend to think that any given negative remark shows more hate and less empathy when it's made directly to the person it's about. Compare "X isn't terribly bright" with "You aren't terribly bright".)
Yet you take the time to reply. This always baffles me.
If I told you you were being boring, you should wonder why I would bother to reply, or if I'm being dishonest in an effort to be hurtful.
Regardless, even if it wasn't, its at worst silly. Its not like he is scamming people out of money.
Edit: after looking at a few more pages, now im not sure what to think. Maybe im wrong. The untracked browser stuff seems like it could be an actual scam on those who dont know what they are doing. Its all so much more extreme than i thought.
Maybe this all is an attempt to link farm in order to get SEO to scam people. In which case it makes me feel complicit.
This means you can use a 50 and 127 tooth gear pair to do conversions and make metric threads accurately on an imperial lathe, and vice versa.
[1] https://en.wikipedia.org/wiki/Carl_Edvard_Johansson#Johansso...
That would make the inch precisely (1/10 000)^8 meters.
Instead, we're stuck with almost that. Forever.