On March 14th, we're celebrating π-day! Why March 14th? Well, if you write dates with month first and date second, you'll get 3/14, the beginning of the digits of the irrational number!
At Restlet, we're fans of APIs, so we thought it would be fun to create an API for Pi, to discover the digits of our favorite number. The API was created with the APISpark platform, and you can easily try the API out with DHC by Restlet.
Get a chance to win a brand new Raspberry Pi 3 by using the π API!
First of all, a big of background on π, straight from Wikipedia:
The number π is a mathematical constant, the ratio of a circle's circumference to its diameter, commonly approximated as 3.14159. It has been represented by the Greek letter "π" since the mid-18th century, though it is also sometimes spelled out as "pi".
Being an irrational number, π cannot be expressed exactly as a fraction (equivalently, its decimal representation never ends and never settles into a permanent repeating pattern). Still, fractions such as 22/7 and other rational numbers are commonly used to approximate π. The digits appear to be randomly distributed; however, to date, no proof of this has been discovered. Also, π is a transcendental number – a number that is not the root of any non-zero polynomial having rational coefficients. This transcendence of π implies that it is impossible to solve the ancient challenge of squaring the circle with a compass and straightedge.
The Raspberry Pi 3 is the third generation Raspberry Pi.
The goal is to find all the pages (a page contains a thousand digits of Pi, starting from 0), among the first million digits of π, where the sequence 12345 appears.
So where does 12345 appear in the first 1000 thousand pages of π digits?
The π
API
is pretty straightforward to call.
You just have to issue a GET request on:
https://apidigits.apispark.net/v1/digits/{page}
where {page} is the number of the page of a thousand digits you want to look at.
So if you call this URL:
https://apidigits.apispark.net/v1/digits/0
it will return the first thousand digits after 3. And when calling:
https://apidigits.apispark.net/v1/digits/1
you will get from the 1000th to 1999th digits after the dot.
You can use DHC by Restlet to invoke the API, to go through the digits.
This API has a billion digits of π in store! We collected the first billion digits from this MIT website.
But for our challenge, you don't need to go through all those digits! Fortunately, you'll only have to search though the first million digits (ie. from page 0 to page 999).
The API has been designed and deployed on the Restlet APISpark API platform.
Ready? Let's the hunt begin!
You have till Sunday, March 20th, to enter the contest! To submit your answer, to get a chance to win the Raspberry Pi 3, you'll have to create an account on the Restlet platform, by clicking the "Sign in" button in the top right hand corner, and fill this Google Form with the following information: