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.

Showing 1-3 of 3 results.

A134941 Mountain numbers.

Original entry on oeis.org

1, 121, 131, 141, 151, 161, 171, 181, 191, 1231, 1241, 1251, 1261, 1271, 1281, 1291, 1321, 1341, 1351, 1361, 1371, 1381, 1391, 1421, 1431, 1451, 1461, 1471, 1481, 1491, 1521, 1531, 1541, 1561, 1571, 1581, 1591, 1621, 1631, 1641, 1651, 1671, 1681, 1691, 1721
Offset: 1

Views

Author

Omar E. Pol, Nov 22 2007

Keywords

Comments

For n > 1 the structure of digits represents a mountain. The first digit is 1. The last digit is 1. The first digits are in increasing order. The last digits are in decreasing order. The numbers only have one largest digit. This sequence is finite. The last term is 12345678987654321.
The total number of terms is 21846. - Hans Havermann, Nov 25 2007
A002450(8) + 1 = 21846. - Reinhard Zumkeller, May 17 2010
From Reinhard Zumkeller, May 25 2010: (Start)
A178333 is the characteristic function of mountain numbers: A178333(a(n)) = 1;
A178334(n) is the number of mountain numbers <= n;
A178052 and A178053 give sums of digits and digital roots of mountain numbers;
A178051(n) is the peak value of the n-th mountain number. (End)

Examples

			The A-number of this sequence (A134941) is itself a mountain number:
  . . . 9 . .
  . . . . . .
  . . . . . .
  . . . . . .
  . . . . . .
  . . 4 . 4 .
  . 3 . . . .
  . . . . . .
  1 . . . . 1
		

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndices)
    a134941 n = a134941_list !! (n-1)
    a134941_list = elemIndices 1 a178333_list
    -- Reinhard Zumkeller, Oct 28 2001
    
  • Mathematica
    mountainQ[n_] := MatchQ[ IntegerDigits[n], {1, a___, b_, c___, 1} /; OrderedQ[{1, a, b}, Less] && OrderedQ[ Reverse[{b, c, 1}], Less]]; mountainQ[1] = True; Select[Range[2000], mountainQ] (* Jean-François Alcover, Jun 13 2012 *)
    Prepend[Union @@ ((FromDigits@#&/@Flatten[Table[Join[(k=Prepend[#,1]&/@
    Subsets[Range[2,#-1]])[[i]], {#}, (Reverse@# & /@k)[[j]]],
    {i, 2^(# - 2)}, {j, 2^(# - 2)}], 1])&/@Range[9]), 1] (* Hans Rudolf Widmer, Apr 30 2024 *)
  • Python
    from itertools import product
    def ups():
        d = "23456789"
        for b in product([0, 1], repeat=8):
            yield "1" + "".join(d[i]*b[i] for i in range(8))
    def downsfrom(apex):
        if apex < 3: yield "1"*int(apex==2); return
        d = "8765432"[-(apex-2):]
        for b in product([0, 1], repeat=len(d)):
            yield "".join(d[i]*b[i] for i in range(len(d))) + "1"
    def A134941(): # return full sequence as a list
        mountain_strs = (u+d for u in ups() for d in downsfrom(int(u[-1])))
        return sorted(int(ms) for ms in mountain_strs)
    print(A134941()[:45]) # Michael S. Branicky, Dec 31 2021

A178333 Characteristic function of mountain numbers.

Original entry on oeis.org

0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Reinhard Zumkeller, May 25 2010

Keywords

Comments

a(A134941(n)) = 1; a(A134951(n)) = 1;
a(n) = 0 for n > 12345678987654321;
a(A011540(n))=0; a(A052383(n))=0; a(A171901(n))=0;
A178334(n) = SUM(a(k): 0<=k<=n).

Crossrefs

Programs

  • Haskell
    a178333 n = fromEnum $
       n `mod` 10 == 1 && a000030 n == 1 && a196368 n == 1 && and down where
          down = dropWhile (== False) $ zipWith (<) (tail $ show n) (show n)
    a178333_list = map a178333 [0..]
    -- Reinhard Zumkeller, Oct 28 2001
  • Mathematica
    a[n_] := Boole[ MatchQ[ IntegerDigits[n], {1, a___, b_, c___, 1} /; OrderedQ[{1, a, b}, Less] && OrderedQ[ {b, c, 1}, Greater]]]; a[1]=1; Table[a[n], {n, 0, 200}] (* Jean-François Alcover, Jun 13 2012 *)

Formula

a(n) = if n mod 10 = 1 then if n = 1 then 1 else g(n div 10, 1) else 0
with g(x, y) = if x mod 10 > y then g(x div 10, x mod 10) else if x mod 10 = y then 0 else h(x div 10, x mod 10)
and h(x, y) = if y = 1 then 0^x else if x mod 10 < y then h(x div 10, x mod 10) else 0.

A135417 Number of mountain numbers (see A134941) with n digits.

Original entry on oeis.org

1, 0, 8, 56, 252, 784, 1792, 3108, 4166, 4352, 3544, 2232, 1068, 376, 92, 14, 1
Offset: 1

Views

Author

Suggested by Jonathan Vos Post, Nov 24 2007 and computed by Hans Havermann and Joshua Zucker, Nov 25 2007

Keywords

Comments

The total number is 21846.

Examples

			Contribution from _Reinhard Zumkeller_, May 25 2010: (Start)
a(1) = A178334(9) = 1;
a(2) = A178334(99) - A178334(9) = 1 - 1 = 0;
a(3) = A178334(999) - A178334(99) = 9 - 1 = 8;
a(4) = A178334(9999) - A178334(999) = 65 - 9 = 56. (End)
		
Showing 1-3 of 3 results.