TransWikia.com

Accomplice numbers

Puzzling Asked by Display maths on February 19, 2021

The reverse of a number is the number obtained by reading the initial number from right to left: for example, the reverse of 125 is 521. Two integers are said to be accomplices when these numbers are written with the same number of digits, each one is different from his reverse and from that of the other, and the product of the two numbers is equal to the product of their reversals.
Thus, the numbers 42 and 12 are accomplices, because 42 × 12 = 24 × 21.(42,12) and (24,21) are different pairs. How many pairs of 3 digit long integers are there?

One Answer

There are 240 pairs of three-digit integers that satisfy the constraints:

102 402
102 603
102 804
103 602
103 903
104 802
112 422
112 633
112 844
113 622
113 933
114 822
122 442
122 663
122 884
123 642
123 963
124 842
132 462
132 693
133 662
133 993
134 862
142 482
143 682
144 882
201 204
201 306
201 408
203 604
203 906
204 201
204 603
204 804
206 301
206 903
208 401
211 224
211 336
211 448
213 624
213 936
214 824
221 244
221 366
221 488
223 644
223 966
224 211
224 633
224 844
226 311
226 933
228 411
231 264
231 396
233 664
233 996
234 864
241 284
243 684
244 221
244 663
244 884
246 321
246 963
248 421
264 231
264 693
266 331
266 993
268 431
284 241
286 341
288 441
301 206
301 309
302 406
302 609
304 806
306 201
306 402
306 804
309 301
309 602
311 226
311 339
312 426
312 639
314 826
321 246
321 369
322 446
322 669
324 846
331 266
331 399
332 466
332 699
334 866
336 211
336 422
336 844
339 311
339 622
341 286
342 486
344 886
366 221
366 442
366 884
369 321
369 642
396 231
396 462
399 331
399 662
401 208
402 102
402 306
402 408
403 608
406 302
406 906
408 201
408 402
408 603
411 228
412 428
413 628
421 248
422 112
422 336
422 448
423 648
426 312
426 936
428 412
431 268
432 468
433 668
441 288
442 122
442 366
442 488
443 688
446 322
446 966
448 211
448 422
448 633
462 132
462 396
466 332
466 996
468 432
482 142
486 342
488 221
488 442
488 663
602 103
602 309
603 102
603 204
603 408
604 203
604 609
608 403
609 302
609 604
622 113
622 339
624 213
624 639
628 413
633 112
633 224
633 448
639 312
639 624
642 123
642 369
644 223
644 669
648 423
662 133
662 399
663 122
663 244
663 488
664 233
664 699
668 433
669 322
669 644
682 143
684 243
688 443
693 132
693 264
699 332
699 664
802 104
804 102
804 204
804 306
806 304
822 114
824 214
826 314
842 124
844 112
844 224
844 336
846 324
862 134
864 234
866 334
882 144
884 122
884 244
884 366
886 344
903 103
903 206
906 203
906 406
933 113
933 226
936 213
936 426
963 123
963 246
966 223
966 446
993 133
993 266
996 233
996 466

Here's the Python script: (not the best, but it works)

def check_accomplice(num1, num2):
    n1 = str(num1)
    n1 = list(n1)
    n2 = str(num2)
    n2 = list(n2)
    if len(n1) != len(n2): return False
    mult1 = int(''.join(n1)) * int(''.join(n2))
    flip1 = n1[::-1]
    flip2 = n2[::-1]
    mult2 = int(''.join(flip1)) * int(''.join(flip2))
    if ''.join(flip1) == ''.join(n1) or ''.join(flip2) == ''.join(n2): return False
    if ''.join(flip1) == ''.join(n2) or ''.join(flip2) == ''.join(n1): return False
    if mult1 != mult2: return False
    return True


count = 0
for i in range(100, 1000):
    for j in range(100, 1000):
        if check_accomplice(i, j):
            count += 1
            print(i, j)

print(count)

Answered by Voldemort's Wrath on February 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP