Question: Permutation testing

Hey folks and (almost) Merry Christmas!

 

How do I check if a number is a permutation of another number (doesn't have to be a cyclic one though)

 

E.g...

 

Let x = 123456789

 

How would I test to see that, for example, 847591236 is a permutation of x without generating every permutation of x?

I feel there should be an obvious command for this but I can't seem to find any...

 

A way I'd do it now would be to just check to see if 847591236 contained every character in x using StringTools. Something like... Has(847591236, x[1]) and so on after converting x to a string.

Please Wait...