A359982 Numbers whose digits are distinct nonprimes and are not a permutation of a smaller such number.
0, 1, 4, 6, 8, 9, 10, 14, 16, 18, 19, 40, 46, 48, 49, 60, 68, 69, 80, 89, 90, 104, 106, 108, 109, 146, 148, 149, 168, 169, 189, 406, 408, 409, 468, 469, 489, 608, 609, 689, 809, 1046, 1048, 1049, 1068, 1069, 1089, 1468, 1469, 1489, 1689, 4068, 4069, 4089, 4689, 6089, 10468, 10469, 10489, 10689, 14689, 40689, 104689
Offset: 1
Examples
10 is in the sequence as both 1 and 0 are nonprime, all digits are distinct, and no permutation of those digits yields a smaller number (with no leading 0's). 14 is in the sequence as both 1 and 4 are nonprime, all digits are distinct, and no permutation of those digits yields a smaller number. 41 is not in the sequence as 14 is a permutation of its digits and is a smaller number. 189 is in the sequence, so its permutations 198, 819, 891, 918 and 981, all of which are larger, are not. 104689 is in the sequence as all digits are nonprime and distinct, and no permutation of those digits yields a smaller number (with no leading 0's).
Programs
-
Maple
sort(map(x-> parse(cat(`if`(nops(x)>1 and x[1]=0, [x[2], x[1], x[3..-1][]], x)[])), [seq(combinat[choose] ([0, 1, 4, 6, 8, 9], i)[], i=1..6)]))[]; # Alois P. Heinz, Jan 27 2023
-
Python
import itertools nums, combinations, flat_list = [0,1,4,6,8,9],[],[] for r in range(len(nums)+1): for combination in itertools.combinations(nums, r): combinations.append(list(combination)) for var in range(len(combinations)): subitems="" if (len(combinations[var]) > 1 and combinations[var][0] == 0) : combinations[var][0], combinations[var][1] = combinations[var][1], combinations[var][0] for sub in combinations[var]: subitems += str(sub) flat_list.append(int(subitems)) print(sorted(set(flat_list)))
Comments