my $p= 0; while( 1 ) { print "$p\n" if (1x++$p) !~ /^(..+)\1+$/; }