Problem 2354 · Hard

Number of Excellent Pairs

The OR and AND of two numbers together carry exactly the set bits of both, so a pair is excellent by bit counts alone; tally distinct values by bit count and combine the tallies.

Open the interactive visualisation