Skip to main content
2 of 2
deleted 1 character in body
Deadcode
  • 11.9k
  • 10
  • 10

Call the input a natural number \$n\$. I don't see a qualitative difference between:

  • Returning one number, in a challenge where it so happens that the reciprocal of the correct output is always infinity or a natural number \$≤n\$
  • Returning two numbers \$(a,b)\$, to represent a fraction \$a\over b\$ where the numerator and denominator are both guaranteed to be \$≤n\$
  • Returning two numbers \$(a,b)\$, encoding \$an+b\$, to represent a natural number that is guaranteed to be \$≤n^2+n\$
  • Returning three numbers \$(a,b,c)\$, encoding \$an^2+bn+c\$, to represent a natural number that is guaranteed to be \$≤n^3+n^2+n\$
  • Returning four numbers \$(a,b,c,d)\$, encoding \$(an+b)\over(cn+d)\$, where the numerator and denominator are guaranteed \$≤n^2+n\$
  • Returning two numbers \$(a,b)\$, encoding \$a×2^{b-\lfloor {n/2} \rfloor}\$ (floating point)
  • Returning four numbers \$(a,b,c,d)\$, encoding \${a\over b}+{c\over d}i\$ (complex rational number)
  • Returning four numbers \$(a,b,c,d)\$, encoding \${a\over b}+{c\over d}\pi\$
  • Various combinations thereof, and beyond

So the options are:

  1. Consider each of the above to be a distinct language, following the established PPCG convention regarding command-line parameters. The N-mover answer would then be unchanged, except perhaps to call the language something like "Regex (ECMAScript, reciprocal output)".
  2. Represent this metadata in some standard format (with the number of each backreference, and what it represents – \0 could indicate the return match itself), and add it to the byte cost of the regex. Then this would be a new language, focusing on pure regexes and confining the metadata format in a way that honors that restriction.
Deadcode
  • 11.9k
  • 10
  • 10