We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
If you have 3 instances of 'ab', the total number of anagram pairs is 2+1 = 3. In general, if you have n instances the number of anagram pairs is n-1 + n-2 + ... + 1. That simplifies to n*(n-1)/2 (they're actually the triangular numbers https://en.wikipedia.org/wiki/Triangular_number)
Sherlock and Anagrams
You are viewing a single comment's thread. Return to all comments →
If you have 3 instances of 'ab', the total number of anagram pairs is 2+1 = 3. In general, if you have n instances the number of anagram pairs is n-1 + n-2 + ... + 1. That simplifies to n*(n-1)/2 (they're actually the triangular numbers https://en.wikipedia.org/wiki/Triangular_number)