# Largest five adjacent number

```ruby
var k = 5
var n = 1e1000.irand
 
say "length(n) = #{n.len}"
 
var c = n.digits.cons(k)
 
say ("Min #{k}-digit sub-number: ", c.min_by { .digits2num }.flip.join)
say ("Max #{k}-digit sub-number: ", c.max_by { .digits2num }.flip.join)
```

#### Output:

```
length(n) = 1000
Min 5-digit sub-number: 00072
Max 5-digit sub-number: 99861
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trizen.gitbook.io/sidef-lang/programming_tasks/l/largest_five_adjacent_number.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
