From 7784568a5c60cc77262130459391f03ab8116f26 Mon Sep 17 00:00:00 2001 From: Lindsey Frazier Date: Mon, 29 Apr 2024 12:58:43 -0400 Subject: [PATCH] Update README.md --- README.md | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index b2ae49b..f57bf89 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # FindInPi -A Kotlin HTTP API to searching pi for specific strings of numbers. Includes a pure kotlin and C/JNI/kotlin impelemntation. +A Kotlin HTTP API for searching Pi for specific series of numbers. Includes both pure Kotlin and C/JNI/Kotlin impelemntations. ## Why? -Pi is probably the most famous irrational number. As an irrational number, when pi is represented as a decimal it is a never ending, never permanently repeating, seemingly random stream of numbers. +Pi is the world's most famous irrational number. As an irrational number, Pi is a never ending, never permanently repeating, seemingly random stream of numbers when represented as a decimal. -Pi has long been popular to calculate to many digits using computers, with the world record at the time of this writing being over 100 trillion digits. +Pi has long been a popular reference number by which to calculate numbers to many digits using computers, with the world record at the time of this writing being over 100 trillion digits. -A random number number this long contains many other smaller numbers, such as your social securty number, phone number, birthday, etc. These numbers occur by chance, but it can still be interesting to see exactly where in pi some of these numbers might occur. +A random number this long contains many smaller number series, such as your social securty number, phone number, birthday, etc. These numbers occur by chance, but it can still be interesting to see exactly where in Pi some of these numbers might occur. -Let's use phone numbers as an example. US phone numbers are 10 digits long, so there are 1010 possible phone numbers. If we were to randomly generate 1010 10-digit numbers, the resulting set should contain nearly all possible values. Following this we can see that in any random string of digits, if we want to find any decimal number of length n, our string of digits must be 10n * n digits long. So in our example we'd need 1010 * 10 digits of pi, or 100 billion digits. +Let's use phone numbers as an example. US phone numbers are 10 digits long, so there are 1010 possible phone numbers. If we were to randomly generate 1010 10-digit numbers, the resulting set should contain nearly all possible values. For example, in any random string of digits, if we want to find any decimal number of length n, our string of digits must be 10n * n digits long. So in our example, we would need 1010 * 10 digits of Pi, or 100 billion digits. -This program was written for pi day 2024, and it can be used to search large pi data files for any string of digits. +This program was written for Pi day 2024 and can be used to search large Pi data files for any string of digits. ## Building ### Prerequisites - Java 11+ @@ -28,35 +28,37 @@ To build only the native library: ## Running ### Prerequisites -Before running, you'll need to provide a pi data file. The file should be a **SINGLE LINE** text file containg the +Before running, you'll need to provide a Pi data file. The file should be a **SINGLE LINE** text file containg the digits of pi. -The [file](src/main/resources/Pi1M.txt) provided with this repository is only 1M digits long, which isn't very +NOTE: The [file](src/main/resources/Pi1M.txt) provided with this repository is only 1M digits long, which isn't very interesting to search. #### Getting a data file -You download some 1B+ digit calculations of pi from [here](https://stuff.mit.edu/afs/sipb/contrib/pi/), -or you can calculate your own pi data file with [y-cruncher](http://www.numberworld.org/y-cruncher/), or you - -Set the location of the file as an environment variable: +To get Pi data, you can do the following: +- Download 1B+ digit calculations of Pi from [here](https://stuff.mit.edu/afs/sipb/contrib/pi/) +- Calculate your own Pi data file with [y-cruncher](http://www.numberworld.org/y-cruncher/) +- Perform the following steps: + +1. Set the location of the file as an environment variable: ```shell $ export PI_DATA=[location of data file] ``` -Run the program: +2. Run the program: ```shell $ ./gradlew run ``` -You can also set the location of the data file as a program argument: +Optional: Set the location of the data file as a program argument: ```shell $ ./gradlew run -PpiData=[location of data file] ``` ### Usage -To use the HTTP API once running: +After you run the program, use the HTTP API: ```shell $ curl --request POST \ --header 'Content-Type: application/json' \ --url 'http://localhost:8080/search' \ --data '{"searchText":"62643"}' -``` \ No newline at end of file +```