Largest five adjacent number: Difference between revisions
Content added Content deleted
(Created page with "{{Draft task}} ;Task: <br>Generate random 1000-digit number. <br> Find the four adjacent digits in the 1000-digit number that have the greatest product are. <br><br> =={{h...") |
No edit summary |
||
Line 3: | Line 3: | ||
;Task: |
;Task: |
||
<br>Generate random 1000-digit number. |
<br>Generate random 1000-digit number. |
||
<br> Find the |
<br> Find the five adjacent digits in the 1000-digit number that have the greatest product are. |
||
<br><br> |
<br><br> |
Revision as of 15:10, 27 September 2021
Largest five adjacent number is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
Generate random 1000-digit number.
Find the five adjacent digits in the 1000-digit number that have the greatest product are.
Ring
<lang ring> digit = "" max = 0 maxOld = 0 limit = 1000
for n = 1 to limit
rand = random(9) randStr = string(rand) digit += randStr
next
for n = 1 to len(digit)-5
res = substr(digit,n,5) resNum = number(res) if resNum > maxold max = resNum maxOld = max ok
next
see max + nl </lang>
- Output:
99638