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.

A134941 Mountain numbers.

This page as a plain text file.
%I A134941 #47 May 26 2024 18:59:00
%S A134941 1,121,131,141,151,161,171,181,191,1231,1241,1251,1261,1271,1281,1291,
%T A134941 1321,1341,1351,1361,1371,1381,1391,1421,1431,1451,1461,1471,1481,
%U A134941 1491,1521,1531,1541,1561,1571,1581,1591,1621,1631,1641,1651,1671,1681,1691,1721
%N A134941 Mountain numbers.
%C A134941 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.
%C A134941 The total number of terms is 21846. - _Hans Havermann_, Nov 25 2007
%C A134941 A002450(8) + 1 = 21846. - _Reinhard Zumkeller_, May 17 2010
%C A134941 From _Reinhard Zumkeller_, May 25 2010: (Start)
%C A134941 A178333 is the characteristic function of mountain numbers: A178333(a(n)) = 1;
%C A134941 A178334(n) is the number of mountain numbers <= n;
%C A134941 A178052 and A178053 give sums of digits and digital roots of mountain numbers;
%C A134941 A178051(n) is the peak value of the n-th mountain number. (End)
%H A134941 Joshua Zucker, <a href="/A134941/b134941.txt">Table of n, a(n) for n = 1..21846</a> (shows all terms).
%e A134941 The A-number of this sequence (A134941) is itself a mountain number:
%e A134941   . . . 9 . .
%e A134941   . . . . . .
%e A134941   . . . . . .
%e A134941   . . . . . .
%e A134941   . . . . . .
%e A134941   . . 4 . 4 .
%e A134941   . 3 . . . .
%e A134941   . . . . . .
%e A134941   1 . . . . 1
%t A134941 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 *)
%t A134941 Prepend[Union @@ ((FromDigits@#&/@Flatten[Table[Join[(k=Prepend[#,1]&/@
%t A134941 Subsets[Range[2,#-1]])[[i]], {#}, (Reverse@# & /@k)[[j]]],
%t A134941 {i, 2^(# - 2)}, {j, 2^(# - 2)}], 1])&/@Range[9]), 1] (* _Hans Rudolf Widmer_, Apr 30 2024 *)
%o A134941 (Haskell)
%o A134941 import Data.List (elemIndices)
%o A134941 a134941 n = a134941_list !! (n-1)
%o A134941 a134941_list = elemIndices 1 a178333_list
%o A134941 -- _Reinhard Zumkeller_, Oct 28 2001
%o A134941 (Python)
%o A134941 from itertools import product
%o A134941 def ups():
%o A134941     d = "23456789"
%o A134941     for b in product([0, 1], repeat=8):
%o A134941         yield "1" + "".join(d[i]*b[i] for i in range(8))
%o A134941 def downsfrom(apex):
%o A134941     if apex < 3: yield "1"*int(apex==2); return
%o A134941     d = "8765432"[-(apex-2):]
%o A134941     for b in product([0, 1], repeat=len(d)):
%o A134941         yield "".join(d[i]*b[i] for i in range(len(d))) + "1"
%o A134941 def A134941(): # return full sequence as a list
%o A134941     mountain_strs = (u+d for u in ups() for d in downsfrom(int(u[-1])))
%o A134941     return sorted(int(ms) for ms in mountain_strs)
%o A134941 print(A134941()[:45]) # _Michael S. Branicky_, Dec 31 2021
%Y A134941 Cf. A134853, A135417, A134951, A182721.
%Y A134941 Cf. A115300, A175044. - _Reinhard Zumkeller_, May 25 2010
%K A134941 base,fini,full,nonn
%O A134941 1,2
%A A134941 _Omar E. Pol_, Nov 22 2007