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.

A369184 a(n) is the first positive number that has exactly n anagrams which have 3 prime divisors, counted by multiplicity, or 0 if there is no such number.

Original entry on oeis.org

1, 8, 103, 117, 156, 268, 1038, 1027, 1059, 1246, 1245, 1347, 1578, 3789, 10136, 10126, 10234, 10355, 10157, 10236, 10158, 11456, 10247, 10245, 10289, 10237, 10235, 10347, 10256, 10257, 10246, 10789, 10239, 10579, 12567, 10578, 13457, 12369, 14559, 12458, 12579, 23789, 24789, 12459, 100258, 12345
Offset: 0

Views

Author

Robert Israel, Jan 15 2024

Keywords

Comments

An anagram of a number k is a permutation of the base-10 digits of k with no leading 0's.
a(n) is the first k such that A175854(k) = n, or 0 if n is not a term of A175854.
Conjecture: all a(n) > 0.

Examples

			a(5) = 268 because 268 has 5 anagrams that have 3 prime divisors, counted by multiplicity, and is the first number that does that:
268 = 2^2 * 67, 286 = 2 * 11 * 13, 628 = 2^2 * 157, 682 = 2 * 11 * 31, 826 = 2 * 7 * 59.
		

Crossrefs

Cf. A014612, A175854. All terms are in A179239.

Programs

  • Maple
    f:= proc(n) local L, d, w, x, i;
          L:= convert(n, base, 10); d:= nops(L);
          L:= select(t -> t[-1] <> 0, combinat:-permute(L));
          L:= map(t-> add(t[i]*10^(i-1), i=1..d), L);
          nops(select(t -> numtheory:-bigomega(t)=3, L))
    end proc:
    g:= proc(xin,d,n) # first anagrams with n digits starting xin, all other digits >= d
      option remember;
      local i;
      if 1 + ilog10(xin) = n then return xin fi;
      seq(procname(10*xin+i,i,n), i=d..9)
    end proc:
    h:= proc(n) # first anagrams with n digits
      local i,j;
      seq(seq(g(i*10^j,i,n),j=n-1..0,-1),i=1..9)
    end proc:
    N:= 100: # for a(0) .. a(N)
    V:= Array(0..N): count:= 0:
    for i from 1 while count < N+1 do
      for x in [h(i)] while count < N+1 do
        v:= f(x);
        if v <= N and V[v] = 0 then V[v]:= x; count:= count+1; fi
      od
    od:
    convert(V,list);
  • Python
    from sympy import primeomega
    from sympy.utilities.iterables import multiset_permutations
    from itertools import combinations_with_replacement, count, islice
    def func(n): return sum(1 for p in multiset_permutations(str(n)) if p[0]!='0' and primeomega(int("".join(p)))==3)
    def agen(): # generator of terms
        adict, n = dict(), 0
        for d in count(1):
            for f in "123456789":
                for r in combinations_with_replacement("0123456789", d-1):
                    k = int(f+"".join(r))
                    v = func(k)
                    if v not in adict:
                        adict[v] = k
                        while n in adict: yield adict[n]; n += 1
    print(list(islice(agen(), 44))) # Michael S. Branicky, Jan 15 2024