← RoseCode

ROSECODE 330

Buddy numbers

Philippe_57721 · Programming ·

Consider the couple of integers (m,n) = (14, 224)

We have:
  • 14 = 2^1 * 7^1
  • 224 = 2^5 * 7^1
  • 14+1 = 3^1 * 5^1
  • 224+1 = 3^2 * 5^2
n, m have the same prime factors {2,7} and so have n+1, m+1 {3,5}.

Let's call these pairs buddy numbers.

If (14,224) is the 3rd pair of buddy numbers, what is the 30th?

[My timing: < 1 sec]
Note: Assume there exists only one pair of odd buddy numbers.