Ad
  • Default User Avatar

    I disagree that positive lookaheads (?=...) make the problem easier. They would make possible solutions generating answers that are more efficient/concise, but the original complexity still needed for the powers of single primes (eg 17), and could allow for larger factors to be tested.

  • Custom User Avatar

    I think the most likely reason is to stay true to the theory of formal languages where the concept of regular expressions came from. See here for a description: https://en.wikipedia.org/wiki/Regular_expression#Formal_language_theory. It's arguable that what we use as regexes aren't 'really' regular expressions since in some cases it gives the programmer 'too much help' (in the case of lookaheads and and repetition quantifiers) and in others it extends beyond the capability of regular languages (like backreferences).

    If the description were to change, I think listing the set of intended operations would be a good idea

  • Custom User Avatar

    With "?=" you could implement kind of "and" logic, which will make the problem easier, since numbers, which and divisible by 6 are divisible by 2 and by 3.

    For the quantifiers I agree with you, they would be handy. On the other hand: this is probably nothing, what is generated "automatically", this would be an outcome of some kind of optimization, but - if I understood it correctly - the goal is to generate the regex on the fly.
    (tivia: if allowing quantifiers, all digits needs to be allowed as well.)