Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ challenge

Name: Anonymous 2013-03-18 1:53

Write a program which will express an integer using only the number 2 (with the exception of 0 for exponents), using any mathematical operations to do so. Try to make it express the amount efficiently, rather than the easy and lazy way of 2+2+2... for evens and 2+2+2... -2^0 for odds.
Any language is acceptable.
For example:
anus@prog ~ $ ./2 num=50
(((2^(2+2+2))-2^(2+2))+2)
anus@prog ~ $

Name: Anonymous 2013-03-18 15:44

Gee, I wonder if there is an easy way of encoding integers in terms of sums of powers of two... maybe there's one built into my PC already, hmm...

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List