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.

A046890 a(n) is the least integer that has exactly n anagrams that are primes.

Original entry on oeis.org

1, 2, 13, 113, 149, 1013, 1039, 1247, 1123, 1349, 1579, 1237, 10127, 10238, 10139, 10235, 10234, 10457, 11579, 10789, 10237, 11239, 12457, 10279, 12349, 12347, 13678, 12359, 14579, 13489, 10379, 12367, 12389, 23579, 13579, 100349, 12379
Offset: 0

Views

Author

Keywords

Comments

An anagram is a permutation of digits not beginning with 0.

Crossrefs

Cf. A046810.

Programs

  • Mathematica
    ap[n_] := Count[FromDigits /@ Select[Permutations[IntegerDigits[n]], First[#] != 0 &], ?PrimeQ]; t = {1}; Do[i = 1; While[ap[i] != n, i++]; AppendTo[t, i], {n, 30}]; t (* _Jayanta Basu, Jun 29 2013 *)
  • Python
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations as mp
    from itertools import count, islice, combinations_with_replacement as mc
    def nd(d): yield from ("".join((f,)+m) for f in "123456789" for m in mc("0123456789", d-1))
    def c(s): return sum(1 for p in mp(s) if p[0]!="0" and isprime(int("".join(p))))
    def agen(): # generator of sequence terms
        n, adict = 0, dict()
        for digs in count(1):
            for s in nd(digs):
                v = c(s)
                if v not in adict: adict[v] = int(s)
                while n in adict: yield adict[n]; n += 1
    print(list(islice(agen(), 40))) # Michael S. Branicky, Feb 08 2023