Skip to main content
add a test link for every Fibonacci up to F_46 (1836311903)
Source Link
Deadcode
  • 11.9k
  • 1
  • 66
  • 52

Try it online! - PCRE2 - every Fibonacci number up to \$F_{46}\$ in under 20 seconds

Try it online! - PCRE2 - every Fibonacci number up to \$F_{46}\$ in under 20 seconds

add 🐇-output versions and optimize the .NET versions
Source Link
Deadcode
  • 11.9k
  • 1
  • 66
  • 52
^(\2?+(\1)|^x)+|^x(xx)?+|^x|^xxx

Try it online!Try it online! - Perl v5.28.2 / Attempt This Online!Attempt This Online! - Perl v5.36+
Try it online!Try it online! - PCRE1
Try it online!Try it online! - PCRE2 v10.33 / Attempt This Online!Attempt This Online! - PCRE2 v10.40+

As in the PCRE1 version, we can change |^x to |^xx to return \$1\$ (instead of \$2\$) for an input of \$1\$.

^(\2?+(\1)|^x)+|^x(xx)?

Try it online! - Perl v5.28.2 / Attempt This Online! - Perl v5.36+
Try it online! - PCRE1
Try it online! - PCRE2 v10.33 / Attempt This Online! - PCRE2 v10.40+

^(\2?+(\1)|^x)+|^x|^xxx

Try it online! - Perl v5.28.2 / Attempt This Online! - Perl v5.36+
Try it online! - PCRE1
Try it online! - PCRE2 v10.33 / Attempt This Online! - PCRE2 v10.40+

As in the PCRE1 version, we can change |^x to |^xx to return \$1\$ (instead of \$2\$) for an input of \$1\$.

add 🐇-output versions and optimize the .NET versions
Source Link
Deadcode
  • 11.9k
  • 1
  • 66
  • 52

Moving the |\b alternative to the end as |^x is a minor speed optimization, at a zero-byte cost. As an added bonus, we can change this to |^xx to return \$1\$ (instead of \$2\$) for an input of \$1\$ or \$2\$.

Moving the |\b alternative to the end as |^x is a minor speed optimization, at a zero-byte cost. As an added bonus, we can change this to |^xx to return \$1\$ (instead of \$2\$) for an input of \$1\$ or \$2\$.

Moving the |\b alternative to the end as |^x is a minor speed optimization, at a zero-byte cost. As an added bonus, we can change this to |^xx to return \$1\$ (instead of \$2\$) for an input of \$1\$.

add 🐇-output versions and optimize the .NET versions
Source Link
Deadcode
  • 11.9k
  • 1
  • 66
  • 52
Loading
fix typo, and improve wording
Source Link
Deadcode
  • 11.9k
  • 1
  • 66
  • 52
Loading
typo fix
Source Link
Deadcode
  • 11.9k
  • 1
  • 66
  • 52
Loading
Add Perl / PCRE version
Source Link
Deadcode
  • 11.9k
  • 1
  • 66
  • 52
Loading
Source Link
Deadcode
  • 11.9k
  • 1
  • 66
  • 52
Loading