From: Marko Schulz Date: 2001-12-20T16:57:06+09:00 Subject: [ruby-talk:29083] Math with RexExps (was: Re: But is it Fun?) On Thu, Dec 20, 2001 at 12:39:08PM +0900, Michael Cook wrote: > > ruby -le '$_ = 1; ("1" * $_) !~ /^(11+)\1+$/ && print while $_ += 1' Looking closer at how you are computing primes with a regular expression: Changing your /^(11+)\1+$/ into /^(1{2,})\1+$/ still lets the program run correctly. But when I tried the following /^(1{2,}){2,}$/ it didn't anymore. Is Rubys (1.6.5) RE-engine doing not enough backtracking for this? -- marko schulz