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.

A055098 Number of distinct anagrams of digits of n without leading zeros.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 4
Offset: 1

Views

Author

Henry Bottomley, Apr 19 2000

Keywords

Examples

			a(101)=2 since the digits of 101 can be ordered 101 or 110 (but not 011).
		

Crossrefs

Programs

  • Haskell
    import Data.List (permutations, nub)
    a055098 n = length $ nub $ filter ((> '0') . head) $ permutations $ show n
    -- Reinhard Zumkeller, Aug 14 2011
    
  • Mathematica
    a[n_] := Length[ DeleteCases[ Permutations[ IntegerDigits[n]], {0 .., }]]; Table[a[n], {n, 1, 102}] (* Jean-François Alcover, Nov 30 2011 *)
  • PARI
    a(n)={my(v=digits(n), f=vector(10), n=#v); for(i=1, #v, f[1+v[i]]++); (1 - f[1]/n) * n! / prod(i=1, #f, f[i]!)} \\ Andrew Howroyd, Jan 27 2020
    
  • Python
    from math import factorial, prod
    def a(n):
        s = str(n); d, c = len(s), [s.count(str(i)) for i in range(10)]
        return (d-c[0])*factorial(d-1)//prod(map(factorial, c))
    print([a(n) for n in range(1, 50)]) # Michael S. Branicky, Aug 24 2022

Formula

a(n) = O(n/(log n)^(9/2)). - Charles R Greathouse IV, Aug 24 2022