Input: from STDIN number of vertices in Graph \$2 \leq N \leq 100\$.
Rules: [Code size] = max ([code length without spaces, tabs and newlines], [total code length divided by 4])
Math formulation: In the graph of N vertices, between each pair of vertices can be 3 road states:
- there is no road
- there is a road from A to B
- there is a road from B to A
Find the number of different graphs on given vertices.
We can apply next formula (number of different road states in pow of pairs number): $$\huge3 ^ {\frac{n(n - 1)}{2}}$$.
My Python 3 37 bytes solution here:
n = int(input())
print(3 ** ((n ** 2 - n) // 2))
I know that exists 34 bytes solution. Then I started to think about 1 liner, and find next formula for sum of arithmetic progression, which use N only once: $$\frac{(2n - 1) ^ 2}{8} - \frac18$$
Unfortunately the code only increased:
x = 2 * int(input()) - 1
print(3 ** ((x ** 2 - 1) // 8))
n**2
=n*n
. \$\endgroup\$-1
too, but 36 bytes is still too long. \$\endgroup\$