Sequence searcher is a project that aims to empower search abilities and enable performing advanced and complex search queries on The Online Encyclopedia of Integer Sequences (OEIS) database. The OEIS database is searchable by keyword and by subsequence and this project provides more advanced options to search in the database (Not to be confused with the official OEIS search engine).
The search features are divided into the following sections:
It gives you the capability to search about a set of numbers in the sequence. Also, you can specify a number of terms to dropped if they are not found in the sequence.
1, 2, 3, 4
: Any sequence contains these four terms without considering order will match (E.g.,A185577, 1, 5, 2, 1, 2, 7, 5, 1, 3, 8, 6, 4
)
1, 2, 3, 4
: Sequence contains these four terms in the same order anywhere in the sequence.
1, 5, ?1, 13, 20
: The third term could be any number (The question mark indicates any possible number).1, 5, ?2, 13, 20
: The third term and the fourth one could be any number (2 means two terms).1, 5, ?*, 13, 20
: Any possible set of numbers between the two sequences [1, 5] and [13, 20].1, 5, ?*, 13, 20, ?3, 60, 70
: Any possible set of numbers between the two sequences [1, 5] and [13, 20], and three numbers between [13, 20] and [60, 70].
1, 5, ?1, 13, 20:23
: The third term could be any number, the fifth is between 20 and 23.1:4, 5, ?1, 13, 20:30
: The first term could be 1, 2, 3 or 4. Also, The third term could be any number, the fifth is between 20 and 23. Note: The search process will show results anywhere in the sequence, i.e. it is not limited to the beginning of the sequence.
This algorithm allows terms in the sequence to be off by a specific number of terms. The results will be ranked according to the number of the dropped terms.
The fuzzy matching has been enhanced to include:
In this type, one term can be dropped at a time from either the OEIS sequence or/and the input sequence. You can specify the number of terms that can be dropped.
Example:
OEIS Sequence A40: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103
Input Sequence : 2, 3, 4, 5, 7, 11, 11, 13, 17, 19, 21, 23, 29, 31, 41, 43, 47, 59, 61, 67, 71, 73, 79, 83, 89
Number of Terms Allowed For Drop: 7
Both Sequences will match.
Rank = Number of Terms Allowed For Drop - The Number of Terms that had Been Dropped = 7 - 5 = 2.
In this algorithm, more than one term can be dropped at a time from either the OEIS sequence or/and the input sequence. You can specify the number of terms that can be dropped and the maximum gap size that is allowed to be skipped while comparing the sequences.
Note: If there is a terms skip in BOTH sequences, the smallest number of terms will be considered to be subtracted from the terms that are allowed to be dropped. For example:
Seq1: 1, 2, 3, 4, 5, 100, 101, 102, 6, 7, 8, 9, 10
Seq2: 1, 2, 3, 4, 5, 100, 101, 102, 103, 104, 6, 7, 8, 9, 10
Number of Terms Allowed For Drop: 6
Maximum Gap Size: 6
The number of terms that will be subtracted from the terms allowed to be dropped is 3 and not 5.
Rank = Number of Terms Allowed For Drop - The Number of Terms that had Been Dropped = 6 - 3 = 3.
In this method, any number of terms can be dropped from the OEIS sequence, but a specific number of terms from the input sequence.
In other words, this type can be used to check the existence of the input sequence terms in the same order in other sequences while allowing some terms to be off.
For example, it could be useful when the sequence is the terms of another sequence according to specific indexing rule (like, k^2 + k + 1)
Input Sequence: 5, 41, 269, 1093, 3299, 7867, 16319
Number of terms allowed to be dropped: 0
The output will be A054553 and A122566 (Until Dec 25)
The input sequence is actually A122566(k^2 + k + 1)
This method allows you to match sequences in the database to formula or terms with a variable
n / 10, n, n * 5, n ^ 2, 3*n+2
: These terms can match the following sequence1, 10, 50, 100, 32
The supported operations are:
- Multiplication (*), Division (/), Addition (+), Subtraction (-) and Power (^).
- Sin, Cos, Tan and Exp (e^number).
- Round, fix or trunc, abs, floor and ceil.
- Constants: PI and E.
Note: This feature will take more time on Windows operating system.
- Shift The Sequence with Constant and Search
- Scale The Sequence with Constant and Search
- Shift The Sequence with (N, N+1, N+2 ...) and Search
- Scale The Sequence with (N, N+1, N+2 ...) and Search
- Scale and Shift The Sequence with Constant and Search
- Scale and Shift The Sequence with (N, N+1, N+2 ...) and Search
- Search About Differences of Adjacent Terms
- Search About Summation of Adjacent Terms
- Search About Product of Adjacent Terms
- Shift with Primes and Search
- Scale with Primes and Search
- Search About Similar Sequence
- Check if the Sequence is The Summation of Two Sequences (Too Much Time - Need Enhancement)
- Check if The Sequence is The Product of Two Sequences (Too Much Time - Need Enhancement)
- Search About Cumulative Sums
- Search About Cumulative Products
- Check if The Input is a Difference of a Sequence in The Database
- Check if The Input is a Sum of Adjacent Terms of a Sequence in The Database
- Check if The Input is a Product of Adjacent Terms of a Sequence in The Database
- Check if The Input is a Cumulative Sum of a Sequence in The Database
- Check if The Input is a Cumulative Product of a Sequence in The Database
This is a framework that gives you the capability to write a python code that can represent a transformation on the OEIS database or the input sequence. Also, it allows you to compare/filter the sequences according to your logic.
Steps:
- Open the
operation.py
python which contains three functions (oeis_transform, input_transform and filter_fun). - oeis_transform: This function will receive all sequences from the database, you need to write your own transformation in this function and return the transformed sequence.
- input_transform: This function will receive the input sequence. A transformation on the input sequence should be written here.
- filter_fun: This function is responsible for the filtering criteria, it will receive both the transformed OEIS sequence and the transformed input sequence. The function now is implemented to check if the input sequence is exist in the OEIS sequence.
- The current implementation in the
operation.py
will work as an ordinary search engine with normal results! - Note: There is no need to restart the program after you edit the
operation.py
file. - After you edit the
operation.py
file as needed, run the script and choose the operation design option. - Results will be filtered and printed automatically.
The database that is used in this project is part of the intellectual property of The Online Encyclopedia of Integer Sequences (OEIS), which is the official search engine for the database. However, the database is made available under the Creative Commons Attribution Non-Commercial 3.0 license and you have to download it from the official website before using this project:
- Clone this repository or download it as a zip archive from GitHub.
- Download two compressed files given here from OEIS.
- Decompress the files, which should have default filenames of
names
andstripped
(without .txt). - Move these two files to the
data
directory. - Install the requirements
pip3 install -r requirements.txt
. - Run
main.py
and enjoy! - Note: The script was only tested on Linux using Python 3.8.10
Disclaimer: This project is under developing and testing, and it may contain bugs which can affect the validity of the results!
- Dr. Neil J. Sloane for his suggestions of Fuzzy Matching and Searching by Terms Lookup Formula.
mm && almazari && 16 [.::at::.] cit [.::dot::.] just [.::dot::.] edu [.::dot::.] jo
- Enhance Fuzzy Matching II - How the terms should be dropped
- Change The Functions Structure - Refactoring
- Terms Selection
- Coloring
- Input Validation in Functions and Try-Exception
- Software Engineering and Packaging
- Enhance Fuzzy Matching - Values Shifting
- Speed Enhancement for Summation/Multiplication of Two Sequences
- Fuzzy Matching II - Implement GAP size control.
- Fuzzy Matching III.
- Terms Lookup Formula - Dropping/Skipping Terms.
- Operation Design
- Fuzzy Matching
- Search by Terms with a Variable
- Terms Lookup Formula Speed Enhancement
- Add More Options in Simple Search Queries (Prime, Odd, Even, Mod, ORing, ANDing)
- Support Parenthesis
- Intelligent Search Operation
- Add Testing Unit
- Input Validation
- Sequence Input Enhancement
- Le Rabot - with extended version - Won't be done (Can be accomplished via Operation Design)
- Test on Windows
- Fix Formula Lookup Multiprocessing on Windows (Spawn Processes Problem)
- View Sequence
- Searching without Order - Dropping Terms.