"number-in-base" ``oneliner''

Jeremy Bowers jerf at jerf.org
Sat Oct 30 13:29:24 EDT 2004


On Sat, 30 Oct 2004 12:12:36 +0000, Andrea Griffini wrote:
> You can't count using base 1 with positional systems.

Well, you can, sort of. You end up with the integers, obviously, and the
result has a rather striking resemblance to the modern foundations of
number theory, in which there is only one number, 0, and the "increment"
function which returns a number one larger. If you want three, it is
expressed increment(increment(increment(0))), which is rather similar to
the base-1 number "111". 

Zero in this system would probably be a null string, making increment this:

def increment(number):
	return "1" + number

(And abracadabra, I'm back on topic for the newsgroup, albeit tenuously :-) )

Some people say base 2 is the most natural base in the universe. But you
can certainly make a claim for base 1, based on its correspondence to
number theory, from which we build the rest of math. (Most people never
dig this deep; it was one of my favorite classes in Comp. Sci., though,
and we're probably the only people other than mathematicians to offer the
course.)



More information about the Python-list mailing list