CTFtime / HSCTF

Tamil Overflow
3 min readJun 6, 2020

How i solved the Pythagorean Tree Fractal 1 & 2?

HSCTF

Pythagorean Tree Fractal 1

when we saw this challenge they provided some PDF file to solve this challenge. Let’s look at the file.

In that some problems. Here they are showing three different rectangles with stages, and the stages are 1, 3, 7.

The problem is “How many rectangles we stage 50 include? Remember to use the flag format!”.

For stage 1 only one rectangle is there, Next at stage 3 there are 7 rectangles there, Like that some more rectangles are in the stage 7. How many rectangles in stage 50?

Let’s look at the difference between stage 1 and stage 3, And try to make a Stage 2 assumption.

Stage 1 = 1 ( rectangle)

Stage 2 = ?

Stage 3 = 7 ( rectangle)

I notice that every stage there 2 rectangles adding on the base rectangle. so the stage 2 with 3 rectangles. One base two new rectangle.

Stage 0 = 0

Stage 1 = 1 + 0 =1

Stage 2 = 2 + 1 + 0 = 3

Stage 3 = 3 + 3 + 1 + 0 = 7

Stage 4 = 4 + 7 + 3 + 1 + 0 = 15

Stage 50 = ?

Finally our assumption was perfectly matches with diagram as shown in that PDF. But we can’t calculate manually. So, let’s make a code to solve this algorithm.

first i created on array with value 0, Next i have used the loop statement from 1 to 50. and then i created on variable to store the value 0. again loop length of that rectangle. then the var variable will store previous values(rectangles). stage + previous rectangles will append on the rectangle array.

Print result will tell our final value.

and the last value is “1125899906842623”. let’s change in to the flag format.

flag{1125899906842623}

Cool we solved the challenge.

Pythagorean Tree Fractal 2

The second to have the some rectangles but the questions was different.

If the square in Stage 1 has an area of 70368744177664, what is the area of the Stage 25 tree ?

Remember to use the flag format!

This one is Quite easy because the gave some clue here “Stage 1 has an area of 70368744177664” for stage 1 area on the Square is equal to 70368744177664. which mean b2 + c2 = a2.

b2 = 70368744177664/ 2

c2= 70368744177664/2

a2 = b2+ c2.

what is the area of the Stage 25 tree ? this is the question.

70368744177664 * 25 = flage{1759218604441600}

flage{1759218604441600}

YouTube channel : TamilOverflow

--

--

Tamil Overflow

Independent Security Researcher, Part Time You-Tuber.