Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 2
    \$\begingroup\$ That's cool how you use the /; test to select a tuple but also :> convert to the desired output format. (I see in the documentation that that's allowed, but only after reading this answer!) You should specify that your function requires the allowed digits to be sorted: it gives the wrong answer 3331 instead of 3313 if called with [{3,1},4]. \$\endgroup\$ Commented Feb 9, 2017 at 23:47
  • \$\begingroup\$ @ngenisis how about Select[FromDigits/@Tuples[Sort@#,#2],PrimeQ][[1]]&@@#& ? \$\endgroup\$ Commented Feb 10, 2017 at 9:19
  • \$\begingroup\$ @martin That doesn't account for tuples starting with 0 and the @@#& seems redundant. \$\endgroup\$ Commented Feb 10, 2017 at 18:48
  • \$\begingroup\$ @ngenisis sorry - didn't account for that \$\endgroup\$ Commented Feb 10, 2017 at 18:52