Numbers with equal rises and falls: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: elided a blank line, moved one-liner functions to top of subroutine code.)
m (added whitespace and highlighting, added the word "decimal", moved the (URL) reference to the OEIS entry to ";See also:".)
Line 1: Line 1:
{{draft task}}
{{draft task}}
When a number is written in base 10, adjacent digits may "rise" or "fall"
When a number is written in base 10,   adjacent digits may "rise" or "fall" as the number is read   (usually from left to right).
as the number is read (usually from left to right).
<br>
OEIS Sequence A296712 describes numbers whose digit sequence in base 10 have equal "rises" and "falls".
<br>
Definition:
<br>
Given the digits of the number are written as a series d:<br>
:* A rise is an index i such that d(i) < d(i+1)
:* A fall is an index i such that d(i) > d(i+1).
<br>
Examples:<br>
:* The number 726169 has 3 rises and 2 falls, so it is not in the sequence.
:* The number 83548 has 2 rises and 2 falls, so it is in the sequence.
<br>


;Task


;Definition:
Print the first 200 numbers in the sequence. Show that the 10 millionth
Given the decimal digits of the number are written as a series &nbsp; <big>d</big>:
(10,000,000th) number in the sequence is 41909002.
:* &nbsp; A &nbsp; ''rise'' &nbsp; is an index &nbsp; <big>i</big> &nbsp; such that &nbsp; <big> d(i) &nbsp;&lt;&nbsp; d(i+1)</big>
:* &nbsp; A &nbsp; ''fall''&nbsp; &nbsp; is an index &nbsp; <big>i</big> &nbsp; such that &nbsp; <big> d(i) &nbsp;&gt;&nbsp; d(i+1)</big>


;See also:
*[[OEIS:A296712]] the Oeis entry.


;Examples:
:* &nbsp; The number &nbsp; '''726169''' &nbsp; has &nbsp; '''3''' &nbsp; rises and &nbsp; '''2''' &nbsp; falls, &nbsp; so it <u>isn't</u> in the sequence.
:* &nbsp; The number &nbsp; &nbsp; '''83548''' &nbsp; has &nbsp; '''2''' &nbsp; rises and &nbsp; '''2''' &nbsp; falls, &nbsp; so it &nbsp; <u>is</u> &nbsp; in the sequence.


;Task:
:* &nbsp; Print the first &nbsp; '''200''' &nbsp; numbers in the sequence
:* &nbsp; Show that the &nbsp; '''10 millionth''' &nbsp; (10,000,000<sup>th</sup>) &nbsp; number in the sequence is &nbsp; '''41909002'''


;See also:
* &nbsp; OEIS Sequence A296712 describes numbers whose digit sequence in base 10 have equal "rises" and "falls". &nbsp;[[OEIS:A296712]].


;Related:
*[[Esthetic_numbers|Esthetic numbers]]


;Related tasks:
* &nbsp; [[Esthetic_numbers|Esthetic numbers]]
<br><br>


=={{header|11l}}==
=={{header|11l}}==