All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
A permutation puzzle 2 (Posted on 2022-05-21) Difficulty: 3 of 5
Each of M, N and P is a 4 digit non-leading zero positive integer such that:
  1. M+N=P
  2. The digits of each of M,N and P are distinct.
  3. Each of M, N and P are permutations of one another.
Determine all possible triplets (M,N,P).

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution | Comment 1 of 3
WLOG say that M <= N.
In that case, I find 21 examples of (M,N,P).
Without that assumption there are 42.
(I found no cases of M = N)

1503 + 3510 = 5013
1530 + 3501 = 5031
1089 + 8019 = 9108
1089 + 8091 = 9180
4095 + 4950 = 9045
4095 + 5409 = 9504
4590 + 4950 = 9540
1269 + 1692 = 2961
2691 + 6921 = 9612
1467 + 6147 = 7614
1467 + 6174 = 7641
1476 + 4671 = 6147
1746 + 4671 = 6417
2439 + 2493 = 4932
4392 + 4932 = 9324
2385 + 2853 = 5238
2538 + 3285 = 5823
2853 + 5382 = 8235
3285 + 5238 = 8523
4698 + 4986 = 9684
4896 + 4968 = 9864
21

If instead we look for 5 digit numbers, the number of solutions, again just looking at M < N, there are 522 solution, none with M = N.  So 1044 allowing for those with M > N.
----------- code -----------
from itertools import permutations
from itertools import combinations
nums = '0123456789'
ct=0
for abcd in combinations(nums,4):
    numbers = []
    for perm in permutations(abcd):
        if perm[0] == '0':
            continue
        numbers.append(int(''.join(perm)))
    for p1 in numbers:
        for p2 in numbers:
            if p2 < p1:
                continue
            if p1 + p2 in numbers:
                print(p1, '+',p2, '=',p1+p2)
                ct += 1
            
print(ct)

  Posted by Larry on 2022-05-21 09:11:45
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information