Post Reply 
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
over 1 trillion permutations of those 15 digits, it would be highly unlikely.

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. Sad

Then, I googled and found this: Distinct permutations of the string | Set 2
Post #9 unique_permute were "borrowed" from article's Python3 code Big Grin
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
scramble prime challenge - Don Shepherd - 02-14-2020, 01:14 AM
RE: scramble prime challenge - Paul Dale - 02-14-2020, 03:02 AM
RE: scramble prime challenge - Albert Chan - 02-14-2020, 04:39 AM
RE: scramble prime challenge - Albert Chan - 02-14-2020, 04:02 PM
RE: scramble prime challenge - Paul Dale - 02-14-2020, 04:43 AM
RE: scramble prime challenge - ttw - 02-14-2020, 01:56 PM
RE: scramble prime challenge - John Keith - 02-14-2020, 10:09 PM
RE: scramble prime challenge - John Keith - 02-15-2020, 06:59 PM
RE: scramble prime challenge - John Keith - 02-16-2020, 07:11 PM
RE: scramble prime challenge - Albert Chan - 02-15-2020, 02:14 PM
RE: scramble prime challenge - Albert Chan - 02-17-2020, 06:23 PM
RE: scramble prime challenge - Albert Chan - 02-19-2020 12:16 AM
RE: scramble prime challenge - Allen - 02-15-2020, 11:11 PM
RE: scramble prime challenge - Allen - 02-16-2020, 02:19 PM



User(s) browsing this thread: 3 Guest(s)