Created
January 19, 2023 20:16
-
-
Save nshCore/e0279d0f72c546a999595e53994d63cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
function permutePhoneNumber(phoneNumber) { | |
const digits = '0123456789'; | |
phoneNumber = phoneNumber.replace(/\*/g, '{}'); | |
const permutations = []; | |
for (let i = 0; i <= 9; i++) { | |
for (let j = 0; j <= 9; j++) { | |
permutations.push(phoneNumber.replace(/\{}/g, i).replace(/\{}/g, j)); | |
} | |
} | |
return permutations; | |
} | |
const permutations = permutePhoneNumber("512-3*1-2*04"); | |
fs.writeFileSync("permutations-node.txt", permutations.join('\n')); | |
console.log(`Permutations saved to permutations.txt`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
def permute_phone_number(phone_number): | |
digits = '0123456789' | |
phone_number = phone_number.replace("*", "{}") | |
for perm in itertools.product(digits, repeat=phone_number.count("{}")): | |
yield phone_number.format(*perm) | |
with open("permutations-py.txt", "w") as f: | |
for permutation in permute_phone_number("512-3*1-2*04"): | |
f.write(permutation + "\n") | |
print("Permutations saved to permutations-py.txt") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
512-301-2004 | |
512-301-2004 | |
512-301-2004 | |
512-301-2004 | |
512-301-2004 | |
512-301-2004 | |
512-301-2004 | |
512-301-2004 | |
512-301-2004 | |
512-301-2004 | |
512-311-2104 | |
512-311-2104 | |
512-311-2104 | |
512-311-2104 | |
512-311-2104 | |
512-311-2104 | |
512-311-2104 | |
512-311-2104 | |
512-311-2104 | |
512-311-2104 | |
512-321-2204 | |
512-321-2204 | |
512-321-2204 | |
512-321-2204 | |
512-321-2204 | |
512-321-2204 | |
512-321-2204 | |
512-321-2204 | |
512-321-2204 | |
512-321-2204 | |
512-331-2304 | |
512-331-2304 | |
512-331-2304 | |
512-331-2304 | |
512-331-2304 | |
512-331-2304 | |
512-331-2304 | |
512-331-2304 | |
512-331-2304 | |
512-331-2304 | |
512-341-2404 | |
512-341-2404 | |
512-341-2404 | |
512-341-2404 | |
512-341-2404 | |
512-341-2404 | |
512-341-2404 | |
512-341-2404 | |
512-341-2404 | |
512-341-2404 | |
512-351-2504 | |
512-351-2504 | |
512-351-2504 | |
512-351-2504 | |
512-351-2504 | |
512-351-2504 | |
512-351-2504 | |
512-351-2504 | |
512-351-2504 | |
512-351-2504 | |
512-361-2604 | |
512-361-2604 | |
512-361-2604 | |
512-361-2604 | |
512-361-2604 | |
512-361-2604 | |
512-361-2604 | |
512-361-2604 | |
512-361-2604 | |
512-361-2604 | |
512-371-2704 | |
512-371-2704 | |
512-371-2704 | |
512-371-2704 | |
512-371-2704 | |
512-371-2704 | |
512-371-2704 | |
512-371-2704 | |
512-371-2704 | |
512-371-2704 | |
512-381-2804 | |
512-381-2804 | |
512-381-2804 | |
512-381-2804 | |
512-381-2804 | |
512-381-2804 | |
512-381-2804 | |
512-381-2804 | |
512-381-2804 | |
512-381-2804 | |
512-391-2904 | |
512-391-2904 | |
512-391-2904 | |
512-391-2904 | |
512-391-2904 | |
512-391-2904 | |
512-391-2904 | |
512-391-2904 | |
512-391-2904 | |
512-391-2904 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
512-301-2004 | |
512-301-2104 | |
512-301-2204 | |
512-301-2304 | |
512-301-2404 | |
512-301-2504 | |
512-301-2604 | |
512-301-2704 | |
512-301-2804 | |
512-301-2904 | |
512-311-2004 | |
512-311-2104 | |
512-311-2204 | |
512-311-2304 | |
512-311-2404 | |
512-311-2504 | |
512-311-2604 | |
512-311-2704 | |
512-311-2804 | |
512-311-2904 | |
512-321-2004 | |
512-321-2104 | |
512-321-2204 | |
512-321-2304 | |
512-321-2404 | |
512-321-2504 | |
512-321-2604 | |
512-321-2704 | |
512-321-2804 | |
512-321-2904 | |
512-331-2004 | |
512-331-2104 | |
512-331-2204 | |
512-331-2304 | |
512-331-2404 | |
512-331-2504 | |
512-331-2604 | |
512-331-2704 | |
512-331-2804 | |
512-331-2904 | |
512-341-2004 | |
512-341-2104 | |
512-341-2204 | |
512-341-2304 | |
512-341-2404 | |
512-341-2504 | |
512-341-2604 | |
512-341-2704 | |
512-341-2804 | |
512-341-2904 | |
512-351-2004 | |
512-351-2104 | |
512-351-2204 | |
512-351-2304 | |
512-351-2404 | |
512-351-2504 | |
512-351-2604 | |
512-351-2704 | |
512-351-2804 | |
512-351-2904 | |
512-361-2004 | |
512-361-2104 | |
512-361-2204 | |
512-361-2304 | |
512-361-2404 | |
512-361-2504 | |
512-361-2604 | |
512-361-2704 | |
512-361-2804 | |
512-361-2904 | |
512-371-2004 | |
512-371-2104 | |
512-371-2204 | |
512-371-2304 | |
512-371-2404 | |
512-371-2504 | |
512-371-2604 | |
512-371-2704 | |
512-371-2804 | |
512-371-2904 | |
512-381-2004 | |
512-381-2104 | |
512-381-2204 | |
512-381-2304 | |
512-381-2404 | |
512-381-2504 | |
512-381-2604 | |
512-381-2704 | |
512-381-2804 | |
512-381-2904 | |
512-391-2004 | |
512-391-2104 | |
512-391-2204 | |
512-391-2304 | |
512-391-2404 | |
512-391-2504 | |
512-391-2604 | |
512-391-2704 | |
512-391-2804 | |
512-391-2904 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment