Negafibonacci Representations

Today I found this amazing question about representing numbers in negafibonacci over on Stack Overflow. The negafibonacci number system represents each integer as a sum of terms of the form (-1)^n F_n using only the digits 0 and 1. I played around with the problem a bit and found a really cool algorithm that efficiently converts numbers into negafibonacci by subdividing the integers into different ranges bounded by Fibonacci numbers and using those ranges to decide which bits to include.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s