Pi chains.

The prime counting function, denoted by π ( x ) \pi(x) counts the number of primes less or equal to x x .

Consider the process of continually finding the value of π ( x ) \pi(x) of x x until it equals zero.

For example,for x = 1000 x=1000 we have π ( 1000 ) = 168 39 12 5 3 2 1 0 \pi(1000) = 168 \rightarrow 39 \rightarrow 12 \rightarrow 5 \rightarrow 3 \rightarrow 2 \rightarrow 1 \rightarrow 0

π ( 20 ) = 8 4 2 1 0 \pi(20) = 8 \rightarrow 4 \rightarrow 2 \rightarrow 1 \rightarrow 0

From the above we can say that 1000 1000 has a pi chain of length 8 and 20 20 has a pi chain of length 5 .

How many integers have a pi chain of length 9 ?


The answer is 47330.

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.

2 solutions

Abdelhamid Saadi
Oct 8, 2015

let f ( n ) f(n) denote the prime at position n.

so we have f ( 1 ) = 2 , f ( 2 ) = 3. f ( 3 ) = 5... f(1) = 2 , f(2) = 3. f(3) = 5 ...

Now we have:

f ( 1 ) = 2 f(1) = 2

f ( 2 ) = 3 f(2)= 3

f ( 3 ) = 5 f(3) = 5

f ( 5 ) = 11 f(5) = 11

f ( 11 ) = 31 f(11) = 31

f ( 31 ) = 127 f(31) = 127

f ( 127 ) = 709 f(127) = 709

f ( 709 ) = 5381 f(709) = 5381

f ( 5381 ) = 52711 f(5381) = 52711

the answer is 52711 5381 = 47330 52711-5381=47330

Sindhu G
Aug 20, 2014

5831 is a number which contains chain of 9 continue the process we get 52710 has chain 9 later 52711has chain 10 so answer is 52711-5831=47330

I have to write lot's of code to find the result

Ronak Agarwal - 6 years, 9 months ago

Log in to reply

can you pls post your code here........?

Sarthak Tanwani - 5 years, 6 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...