Code Monkey home page Code Monkey logo

poetries_in_pi's Introduction

poetries_in_pi

Is the first "terzina" of Dante's Divina Commedia encoded in the first million of decimal digits of pi?

Pi is an irrational number with a decimal representation that “never ends” (3.14159265…). It means that you can find any arbitrary-long sequence of digits.

Let’s consider the first 4 pairs of digits. If you kind of translate them using the following chart, using the rule one pair=one character:

  • 14 = “c”
  • 15 = “i”
  • 92 = “a”
  • 65 = “o” you will obtain the Italian word “ciao”.

We can extend the idea to the point of saying that all the poems written in the centuries are contained in the pi's decimals!

In this project I used the first million of decimal digits of pi (1_milion_decimal_digits.txt) to find the longest possible sequential part of whatever poem (poetry.txt) that exists in pi.

Requirements

R installed on your machine. To download R go to https://cran.r-project.org.

How to run

Add the poem text to the poetry.txt file. By default, there is the first terzina of Dante's Divina Commedia.

Run from the command line:

% Rscript script.R [ NUMBER_OF_DIGITS ] --default-packages=dplyr, strgr

NUMBER_OF_DIGITS: how many digits of pi you want to search through (minimum is length of poem, maximum is 1 million).

Required libraries

The following libraries are required, and will be installed when script.R is run

  • dplyr
  • stringr
  • stringi

Extensions

Adding new decimal digits to the 1_milion_decimal_digits.txt file will make you able to extend the search domain.

poetries_in_pi's People

Contributors

ferrazzipietro avatar abroniewski avatar

Watchers

 avatar

Forkers

abroniewski

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.