A
counting
system that uses only one
digit. The places in the system
follow the same rules as all other
counting systems. The
number
5 is represented in unary as:
11111
which
translates to:
1
4+1
3+1
2+1
1+1
0
However, this yields: 1 + 1 + 1 + 1 + 1 = 5. Much less
interesting than other number systems.
Prime numbers in unary have an interesting property that allows them to
be matched by the following perl regular expression:
perl -le '{(1 x ++$_) !~ /^(11+)\1+$/ && print; redo}'
Compare to binary or decimal