What is the probability they can be arranged in a triangle with each end touching another end with an equal number of spots?

For example: [1|3][3|0][0|1] can form such a triangle.

(Note: this triangle is not a legal configuration in an actual game of dominoes.)

Randomly draw four dominoes instead.

What is the probability of being able to form a square in the same fashion?

How about 5? 6? 27? 26?

There doesn't seem to be a general formula. Is there?