π \pi madness 1

In the first 1 , 000 , 000 1,000,000 digits of π \pi , there are 2 2 digits that occur the same number of times. Let the number of times it occurs be A A , and the digits be B B and C C . Find A × B × C A\times B\times C

Feel free to search for any derivations of π \pi

Details and Assumptions \textbf{Details and Assumptions}

\bullet The first 1 , 000 , 000 1,000,000 digits of π \pi includes the 3 3 in 3.1415... 3.1415... , so if the number is 3.1415 3.1415 there are 5 5 digits in that number.

\bullet Supposing the 2 2 digits that occur the same number of times is 1 1 and 2 2 and the number of times it occurs is 100 100 times, the answer would be 1 × 2 × 100 = 200 1\times 2\times 100=\boxed{200}

Try my Other Problems


The answer is 1202760.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

4 solutions

Anatoliy Razin
Nov 20, 2014

Amazing fact and good subject for algorithm based solution

Easy thing if using tools: DigitCount[IntegerPart[Pi*10^1000000]] - takes a second

Shouldn't this be mentioned that digits include "3" (integral part) also.

Pranjal Jain - 6 years, 5 months ago
Gabriel Alves
Feb 7, 2015

My c++ solution:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <fstream>
#include <cstring>

using namespace std;

int main()
{

    string pi;

    fstream fin ("name_of_your_txt_file_with_1000000_digits_of_pi");

    fin>>pi;

    int rep[10]; //Number of repetitions of each digit
    int i;

    for(i=0;i<=9;i++)  rep[i]=0;

    for(i=0;i<=1000000;i++){
        cout<<pi[i]<<"\n";
        switch(pi[i]){
            case '0':rep[0]++;break;
            case '1':rep[1]++;break;
            case '2':rep[2]++;break;
            case '3':rep[3]++;break;
            case '4':rep[4]++;break;
            case '5':rep[5]++;break;
            case '6':rep[6]++;break;
            case '7':rep[7]++;break;
            case '8':rep[8]++;break;
            case '9':rep[9]++;break;
        }
    }

    for(i=0;i<=9;i++) cout<<i<<" repeats "<<rep[i]<<" times\n";

    return 0;
}

I downloaded a txt file with 1000000 digitis of Pi and used the fin command to read it.

Ilya Andreev
Dec 31, 2014

Here's my Pylution, and a link to 1 million digits of Pi

countList = []
for i in range(10):
f = open('C:\Users\[your username]\Documents\Python\pi.txt', 'r')
totalCount = 0
    for line in f:
        count = 0
        for char in line:
            if char == str(i):
                count += 1
        totalCount += count
    countList.append(totalCount)

for i in range(9):
    for k in range(i+1,10):
        if countList[i] == countList[k]:
            print (i,k,countList[i],i*k*countList[i])

Pylution. Happy new year!

Julian Poon - 6 years, 5 months ago

Log in to reply

Hey, you too! ;]

Ilya Andreev - 6 years, 5 months ago
Aryan Gaikwad
Feb 27, 2015

Easier way - go to http://www.exploratorium.edu/pi/pi_archive/Pi10-6.html and then press Ctrl + F. A box will open. Type a digit and number of times it is repeated will be displayed on it. Find out for each digit.

Only problem was that I realized it after writing my algorithm.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...