Skip to content

Fix typo #3837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix typo
this formula should be 2^(n-1)
  • Loading branch information
bangjiehan authored Apr 18, 2025
commit bc4a2fa657968416f0accd9e8277b0b0ed1a3639
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ Here's what the regexp engine does:
...And so on.


There are many ways to split a sequence of digits `123456789` into numbers. To be precise, there are <code>2<sup>n</sup>-1</code>, where `n` is the length of the sequence.
There are many ways to split a sequence of digits `123456789` into numbers. To be precise, there are <code>2<sup>n-1</sup></code>, where `n` is the length of the sequence.

- For `123456789` we have `n=9`, that gives 511 combinations.
- For a longer sequence with `n=20` there are about one million (1048575) combinations.
- For `n=30` - a thousand times more (1073741823 combinations).
- For `123456789` we have `n=9`, that gives 256 combinations.
- For a longer sequence with `n=21` there are about one million (1048576) combinations.
- For `n=31` - a thousand times more (1073741824 combinations).

Trying each of them is exactly the reason why the search takes so long.

Expand Down