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

Home > Numbers
Binomial Pandigitals 2 (Posted on 2023-05-11) Difficulty: 3 of 5
Determine all possible pairs (M, X) of positive integers with M-1 > X > 1, such that the duodecimal representation of comb(M, X) consists of non leading zeroes, and contains each of the digits from 0 to B exactly once.

Note: comb(M, X) is the number of X-element subsets (the X combinations) of an X-element set, that is the number of ways that X things can be chosen from a set of M things.

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 Solution Comment 1 of 1
I found 332 examples of comb(M, X) only searching for X values less than half of M.  There was one with X=4, two with X=3 and the rest had X=2.
So the answer is 662, double the number found, since comb(M, X) = comb(M, M-X).

I did some pre testing to determine what ranges to check for each value of X.

The limits I found were:
{X: [smallest M, 1 more than largest M]}
{2: [1228641, 4205334], 3: [16546, 37577], 4: [2065, 3819], 5: [621, 1014], 6: [289, 434], 7: [172, 243], 8: [119, 160], 9: [91, 118], 10: [75, 94], 11: [65, 79], 12: [58, 70], 13: [53, 63], 14: [50, 58], 15: [48, 55], 16: [46, 52], 17: [45, 50], 18: [44, 49], 19: [43, 48], 20: [43, 47], 21: [43, 47], 22: [43, 47], 23: [43, 47]}  for X values of 24 or more, every viable M had X > M/2 so these combinations would have already been checked.
Once these limits were determined, the rest of the program ran quickly.  I'm not sure if I saved time overall or not by first finding these limits.  Probably not.

----------------
def fact(n):
    if n == 1 or n == 0:
        return 1
    ans = 1
    for i in range(n):
        ans *= (i+1)
    return ans

factorials = [fact(i) for i in range(24)]

def largeComb(m,a):
    """ combination m things a at a time   """
    a = min(a, m-a)
    num = 1
    # den = 1
    for i in range(a):
        num *= (m-i)
        # den *= (i+1)
    return int(num/factorials[a])

def dec2base(i,base):
    """ INPUT integer in base 10, return string
    of Base base equivalent. """
    convertString = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    if i < base:
        return convertString[i]
    else:
        return dec2base(i//base,base) + convertString[i%base]

smallestDuoP = 754777787027
largestDuoP = 8842413667692

limits = {}
for r in range(2, 24):
    maxM =  10 + int(largestDuoP * fact(r) ** (1/r))
    foundSmall = False
    foundLarge = False
    for i in range (r+2, maxM):
        x = largeComb(i,r)
        if x < smallestDuoP:
            continue
        if x > smallestDuoP and x < largestDuoP:
            if foundSmall == False:
                foundSmall = True
                limits[r] = [i]
        if x > largestDuoP:
            if foundLarge == False:
                foundLarge = True
                limits[r].append(i)
        if foundLarge:
            break

answers  = []
half_uns = []
for r in range(23,1,-1):
    for m in range( limits[r][0] , limits[r][1] ):

        if r > m/2:
            continue
        x = dec2base( largeComb(m,r) , 12 )
        if len(x) == len(set(x)) and len(x) == 12:
            print(m,r,x)
            answers.append([m,r,x])
            if r == m/2:
                half_uns.append([m,r])
print(len(answers), half_uns)

Output printed:   332 [] indicating no cases where M = 2*X

  M       X     comb(M,X) base 12
2324    4 176B520A4839
25356   3 37A618B59024
30459   3 64082A57B391
1230461 2 10286B37459A
1234783 2 1038B7524A69
1251317 2 10789254B36A
1318571 2 12058B63A947
1345906 2 1276534B8A09
1357368 2 12A6579834B0
1390719 2 1375068B24A9
1397353 2 139267A845B0
1407010 2 13BA06847529
1417306 2 1427A3B80659
1422124 2 143B928A0756
1432662 2 146A90285B73
1442804 2 14987B65023A
1445862 2 14A6B2850793
1464200 2 1538BA697024
1502007 2 162748A350B9
1506032 2 16395827A0B4
1521487 2 1683A725B409
1529705 2 16A905B32784
1542520 2 17269A5B8430
1556379 2 17689204BA53
1565520 2 1795B46A3820
1586596 2 183B24A59706
1589863 2 184B326A7059
1590744 2 18526394BA70
1594098 2 1862B4573A09
1607881 2 18A6325794B0
1610709 2 18B4A2753096
1619189 2 192084B7536A
1624172 2 19375B28046A
1626064 2 194278B356A0
1632840 2 19643A72B850
1633721 2 1967805B3A24
1634941 2 1970382AB546
1649637 2 19B853042A76
1651519 2 1A037B428569
1656931 2 1A20596B7843
1664587 2 1A46078925B3
1665235 2 1A4869057B23
1679073 2 1A92463B7580
1699963 2 1B4056287A93
1709566 2 1B726495A803
1738594 2 204AB1357869
1741069 2 2058B34791A6
1751828 2 20947816B53A
1760727 2 2104BA356879
1762102 2 210A754869B3
1776236 2 2158937B046A
1781022 2 21746A598B03
1847264 2 236807BA1954
1849441 2 23754B6A1980
1850586 2 237A40B81659
1856943 2 23A18B654709
1858572 2 23A89504B716
1872101 2 243758691B0A
1872431 2 2438AB590761
1878250 2 245A361087B9
1879802 2 24650A897B31
1886380 2 2489A7130B56
1893948 2 24B7198A5036
1899525 2 2517903A48B6
1907653 2 254789BA1036
1913252 2 25687431B09A
1914451 2 2571B490A863
1924703 2 25AB87469301
1925848 2 25B4A1786930
1937915 2 263B089541A7
1937992 2 263B4A917850
1958506 2 26B843501A79
1959002 2 26BA74950831
1960784 2 27068A5139B4
1971069 2 274591AB3806
1982421 2 2789B5034A16
1991694 2 280497A1B563
2018996 2 28B01759643A
2019688 2 28B347569A10
2020326 2 28B64709A513
2020415 2 28B697354A01
2020965 2 28B9475A0136
2041688 2 297B350A6184
2043294 2 2986AB751043
2069860 2 2A71B8934506
2070156 2 2A7349B81056
2070794 2 2A765843B091
2076283 2 2A98B4076153
2080771 2 2AB678159403
2100121 2 2B7486953A10
2101683 2 2B804195A763
2103046 2 2B8701546A93
2115389 2 301768254B9A
2132175 2 3086572BA149
2132912 2 308A157296B4
2135332 2 309A1725B846
2158618 2 31764A2B8059
2159620 2 317B52940A86
2163305 2 3195B62A0784
2182488 2 3256A98147B0
2187757 2 3279815B04A6
2189176 2 3284A95B6170
2189375 2 3285AB497601
2189408 2 32860B71A954
2192246 2 329865A1B047
2196998 2 32B8965401A7
2228127 2 3410B85A6729
2247388 2 3495270A81B6
2249962 2 34A6815B0279
2252911 2 34BA15062789
2269653 2 35721B8A0496
2286592 2 3627AB198540
2296911 2 3672AB018549
2314048 2 372A965B1480
2327271 2 378A1B246059
2329778 2 379B8A250461
2330977 2 37A629B45180
2344936 2 384A17629B50
2359754 2 38B7250A4691
2414159 2 3B092785A461
2421541 2 3B42891A5076
2423928 2 3B5421A86970
2435048 2 3BA701568924
2449799 2 40569728AB31
2461525 2 40B19278A356
2478850 2 417536B280A9
2485627 2 41A85076B293
2498827 2 4250B1A98673
2511938 2 42B53A798601
2512720 2 42B9A8731560
2516074 2 431560A8B279
2516712 2 43192A687B50
2518648 2 43286AB19570
2525314 2 435B810A7629
2528857 2 43785B6A1290
2529396 2 437B801295A6
2533564 2 43A02581B976
2535985 2 43B258A17960
2565860 2 451B8702369A
2567236 2 4527B1893A06
2576233 2 45718A692B30
2579665 2 458A396B7120
2579973 2 45901B827A36
2583043 2 45A6719B2803
2584209 2 45B1728639A0
2602425 2 4683572A9B10
2605515 2 469A21B05873
2634291 2 480561B97A23
2635997 2 4813B765209A
2638252 2 4825970B3A16
2645060 2 485B7602139A
2646623 2 48692AB75301
2647327 2 48716B05A329
2670548 2 497120856B3A
2683737 2 4A1B35687290
2689929 2 4A51B9267830
2695727 2 4A8235B90761
2695837 2 4A82B9357106
2696254 2 4A857196B203
2704581 2 4B09A8532176
2716671 2 4B72136508A9
2728375 2 501426A38B79
2733060 2 5039B741A286
2734436 2 50468713B29A
2755192 2 513726849AB0
2756501 2 51437298B06A
2756886 2 51460A2B8973
2761441 2 516B372A9840
2763542 2 518096BA2347
2765840 2 51936A8207B4
2769514 2 51B3280A4679
2774069 2 5218703B496A
2796145 2 53176B2498A0
2796706 2 531B28704A69
2819927 2 5426A7B08391
2820269 2 542916B0873A
2829652 2 547A93B18026
2835405 2 54B0813297A6
2871869 2 5672810B439A
2887830 2 57416A9082B3
2888040 2 5742B9A38610
2896531 2 5790124B8A63
2933942 2 59618B032A47
2942325 2 59AB03824716
2942853 2 59B278014A36
2947978 2 5A218B467039
2966558 2 5B096483A217
2982001 2 5B98431A7620
3000119 2 608247B53A91
3026276 2 61B58340729A
3036265 2 6254139BA870
3039356 2 6271B459380A
3046439 2 62B40A597831
3047034 2 62B83570A419
3056285 2 6351B408729A
3065458 2 63A72B145089
3066845 2 63B51742809A
3086535 2 64B203587A19
3087238 2 64B70A295813
3090186 2 65142B7A0839
3105246 2 65A48B217903
3132295 2 6728B305A419
3133417 2 67351428A9B0
3134759 2 6742A895B031
3144658 2 67A3214B0589
3150543 2 681A30B27549
3162544 2 68924351B7A0
3164426 2 68A42537B091
3187591 2 6A07385B2419
3189330 2 6A18254B7309
3214663 2 6B54A3078219
3215135 2 6B58472A3901
3229117 2 70251AB93486
3243142 2 70B286A94153
3252436 2 7150AB938426
3254230 2 71625A4980B3
3254691 2 7165B8A24903
3264305 2 7206A35981B4
3288978 2 7342A61B8509
3294885 2 73801249A5B6
3315577 2 74931A82B650
3325322 2 75364B2A8091
3327468 2 754B01A83296
3351139 2 7682A1945B03
3375757 2 78034B9521A6
3382896 2 784B632519A0
3393424 2 78BA59241360
3401321 2 7950A6231B84
3407064 2 798A416523B0
3414577 2 7A19B3564820
3416480 2 7A3108269B54
3425467 2 7A90684B5213
3433530 2 7B24A5038619
3452108 2 8029753B416A
3455914 2 805423A761B9
3461788 2 80935412BA76
3471732 2 813B752409A6
3472580 2 814657320B9A
3472701 2 814753B9A206
3486285 2 8219450B73A6
3503688 2 83169A7B2450
3512015 2 837290BA5461
3524775 2 843B2017A659
3540922 2 852BA0437619
3550141 2 8593A2B01746
3551582 2 85A39062B417
3568544 2 86A023719B54
3569115 2 86A4B2075193
3585593 2 879A035B1624
3607132 2 890A2145B736
3607780 2 8913742AB506
3621795 2 89B15270A643
3645456 2 8B3947615A20
3648667 2 8B60754A2913
3666521 2 90685B17A324
3669095 2 908654A7B231
3683251 2 916758B40A23
3684814 2 9178A5402B63
3692646 2 9214086B7A53
3695747 2 9236850A4B17
3697694 2 924B53608A17
3717176 2 936B5071A284
3718848 2 9381A65B2740
3739781 2 94B35267180A
3745688 2 9536A2701B84
3754917 2 95A341B02876
3759680 2 9618B730A254
3760241 2 9621A58037B4
3762056 2 96358BA17024
3765026 2 96578B2A4301
3794747 2 983502416BA7
3797388 2 98543BA02716
3800401 2 9876B51243A0
3846469 2 9B587142A036
3852707 2 9BA453602817
3857096 2 A0179583B624
3898764 2 A28B70459316
3935207 2 A50769B48231
3940597 2 A548B2309716
3951047 2 A6089B472531
3956590 2 A64B97018523
3961320 2 A68742319B50
3962795 2 A698B3502147
3964841 2 A6B397520184
3968437 2 A720B8514396
3976578 2 A78423105B69
3982011 2 A806574B9213
3983936 2 A8203719B654
3991570 2 A87B12350649
3993100 2 A89137B24056
3999358 2 A91B57240683
4006178 2 A972B5648301
4030962 2 AB2670135489
4031126 2 AB2815609347
4047032 2 B03165279A84
4047890 2 B0397428A561
4052686 2 B076958214A3
4053578 2 B08324576A91
4053863 2 B085A7469231
4063698 2 B14287A56309
4064226 2 B147865A0329
4074687 2 B20A87354169
4075698 2 B218370A6549
4077789 2 B23415A98706
4078316 2 B2391578406A
4078636 2 B2401A879356
4080978 2 B25A46781309
4081639 2 B2647A138059
4086357 2 B2A157034896
4096136 2 B35A61879024
4100108 2 B3904512876A
4104486 2 B406179A2853
4108204 2 B43578A09216
4110888 2 B4573692A810
4115309 2 B4917068253A
4121272 2 B51A84927630
4135769 2 B615A8970324
4136903 2 B6249780A531
4138761 2 B63A82495170
4143502 2 B6784159A023
4149453 2 B705893A4126
4152291 2 B7291658A043
4154425 2 B7458A926310
4154766 2 B749052816A3
4154789 2 B7493128650A
4157187 2 B76852A09143
4160289 2 B792531A8640
4171530 2 B8634210A579
4184907 2 B9514026A873
4185401 2 B95618730A24
4186579 2 B965740281A3
4191088 2 B9A165478320
  Posted by Larry on 2023-05-11 12:32:35
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
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