Project Euler #312

Sometimes I wish I could share solutions to PE problems. They’re so great! I totally enjoyed every bit of this week’s puzzle. At first you don’t know where to start, it seems so complicated and then you just immense yourself in the pleasure of thinking and bit by bit everything becomes crystal clear so that in the end you can say “Hey! It was easy” πŸ˜€

– A SierpiΕ„ski graph of order-1 (S1) is an equilateral triangle.
– Sn+1 is obtained from Sn by positioning three copies of Sn so that every pair of copies has one common corner.

Let C(n) be the number of cycles that pass exactly once through all the vertices of Sn.
For example, C(3) = 8 because eight such cycles can be drawn on S3, as shown below:

It can also be verified that :
C(1) = C(2) = 1
C(5) = 71328803586048
C(10 000) mod 108 = 37652224
C(10 000) mod 138 = 617720485

Find C(C(C(10 000))) mod 138.


Leave a Reply

Your email address will not be published. Required fields are marked *