# numbers are represented in unary using \e's
# \a is a separator
# start with 100000000
$_=("\e"x100000000)."\a";
# write down all the numbers from 2 to 100000000
while(s/^\e(\e{2,})/\1\a\e\1/) {}
# use the Sieve of Eratosthenes to eliminate the composite numbers
while(s/(?