r/dailyprogrammer • • Feb 17 '12

[2/17/2012] Challenge #9 [difficult]

The U.S government has commissioned you to catch the terrorists!

There is a mathematical pyramid with the following pattern:

1

11

21

1211

111221

312211

you must write a program to calculate up to the 40th line of this pyramid. If you don't, the terrorists win!

3 Upvotes

31 comments sorted by

View all comments

Show parent comment

2

u/Cosmologicon 2 3 Feb 17 '12

Oh well it's still got a lot of computation to do after it starts printing, obviously. I'm curious how long the computation takes.

How long to calculate, for instance, the 100 billionth digit of the 1000th line? No need to print out any digits before that.

1

u/eruonna Feb 17 '12

Turns out the answer is longer than I was willing to wait.

2

u/Cosmologicon 2 3 Feb 17 '12

Psh, I'm sure yours is much faster than mine. Mine takes 7 minutes to finish printing the 40th line! I was just curious so that I would have something to aim for.