You have the first four prime numbers ($2$,$3$,$5$ and $7$) which are gridded and shown as below:
You are trying to get highest total score you can reach with arranging the numbers by rotating (no reflection allowed) them without overlapping them on each other.
The total score is calculated how many lines are joint after arranging and multiplying how many joints you got with the actual prime number and take the sum of all gridded prime number scores at the end. For example, if this question was asked to arrange the first two prime numbers ($2$ and $3$), the answer would be as below:
Since there are 8 lines of the grid are touched with each other, the total score would be $2\times8+3\times8=40$ which is the maximum score you can get with $2$ and $3$.
Note: I am very sorry to let you know there is better answer than 172. That's totally my mistake!