cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A359982 Numbers whose digits are distinct nonprimes and are not a permutation of a smaller such number.

Original entry on oeis.org

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

Views

Author

Glen Gilchrist, Jan 20 2023

Keywords

Comments

The sequence consists of numbers constructed from the combination of the six nonprime digits 0,1,4,6,8,9 without duplication of the digits. Hence there are 2^6 - 1 = 63 terms.

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

Crossrefs

Cf. A062115 (no prime substring), A124673 (distinct prime digits).

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)))