scramble prime challenge
|
02-19-2020, 12:16 AM
Post: #23
|
|||
|
|||
RE: scramble prime challenge
(02-18-2020 05:26 PM)Don Shepherd Wrote: Yeah, I was hoping that, for example, 917371993771911 might be a scramble prime, but with With repeating digits, permutations should use multinomial coefficient For 917371993771911, permutations = \(\large\binom{15}{5,2,4,4} = {15! \over 5! 2! 4! 4!} \) = 9,459,450 I made the same mistake with Python's itertools.permutations, which do n! permutations. With repeated digits, many permutations produce the same patterns, wasting cycles. Then, I googled and found this: Distinct permutations of the string | Set 2 Post #9 unique_permute were "borrowed" from article's Python3 code |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)