# Largest palindrome product

```ruby
func largest_palindrome_product (n) {
 
    for k in ((10**n - 1) `downto` 10**(n-1)) {
        var t = Num("#{k}#{Str(k).flip}")
 
        t.divisors.each {|d|
            if ((d.len == n) && ((t/d).len == n)) {
                return (d, t/d)
            }
        }
    }
}
 
for n in (2..9) {
    var (a,b) = largest_palindrome_product(n)
    say "Largest palindromic product of two #{n}-digit integers: #{a} * #{b} = #{a*b}"
}
```

#### Output:

```
Largest palindromic product of two 2-digit integers: 91 * 99 = 9009
Largest palindromic product of two 3-digit integers: 913 * 993 = 906609
Largest palindromic product of two 4-digit integers: 9901 * 9999 = 99000099
Largest palindromic product of two 5-digit integers: 99681 * 99979 = 9966006699
Largest palindromic product of two 6-digit integers: 999001 * 999999 = 999000000999
Largest palindromic product of two 7-digit integers: 9997647 * 9998017 = 99956644665999
Largest palindromic product of two 8-digit integers: 99990001 * 99999999 = 9999000000009999
Largest palindromic product of two 9-digit integers: 999920317 * 999980347 = 999900665566009999
```


---

# 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_palindrome_product.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.
