Introduction
In the strange world of integer numbers, divisors are like assets and they use to call "rich" the numbers having more divisors than their reversal, while they call "poor" the ones having less divisors than their reversal.
For example, the number \$2401\$ has five divisors : \$1,7,49,343,2401\$, while its reversal, \$1042\$, has only four : \$1,2,521,1042\$.
So \$2401\$ is called a rich number, while \$1042\$ a poor number.
Given this definition, we can create the following two integer sequences of rich and poor numbers :
(here we list the first 25 elements of the sequences)
Index | Poor | Rich
-------|------|-------
1 | 19 | 10
2 | 21 | 12
3 | 23 | 14
4 | 25 | 16
5 | 27 | 18
6 | 29 | 20
7 | 41 | 28
8 | 43 | 30
9 | 45 | 32
10 | 46 | 34
11 | 47 | 35
12 | 48 | 36
13 | 49 | 38
14 | 53 | 40
15 | 57 | 50
16 | 59 | 52
17 | 61 | 54
18 | 63 | 56
19 | 65 | 60
20 | 67 | 64
21 | 69 | 68
22 | 81 | 70
23 | 82 | 72
24 | 83 | 74
25 | 86 | 75
... | ... | ...
Notes :
- as "reversal" of a number we mean its digital reverse, i.e. having its digits in base-10 reversed. This means that numbers ending with one or more zeros will have a "shorter" reversal : e.g. the reversal of
1900
is0091
hence91
- we intentionally exclude the integer numbers having the same number of divisors as their reversal i.e. the ones belonging to OEIS:A062895
Challenge
Considering the two sequences defined above, your task is to write a program or function that, given an integer n
(you can choose 0 or 1-indexed), returns the n-th poor and n-th rich number.
Input
- An integer number (
>= 0
if 0-indexed or>= 1
if 1-indexed)
Output
- 2-integers, one for the poor sequence and one for the rich sequence, in the order you prefer as long as it is consistent
Examples :
INPUT | OUTPUT
----------------------------------
n (1-indexed) | poor rich
----------------------------------
1 | 19 10
18 | 63 56
44 | 213 112
95 | 298 208
4542 | 16803 10282
11866 | 36923 25272
17128 | 48453 36466
22867 | 61431 51794
35842 | 99998 81888
General rules:
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language. - Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
- Default Loopholes are forbidden.
- If possible, please add a link with a test for your code (i.e. TIO).
- Also, adding an explanation for your answer is highly recommended.
2
. For this, see Corollary 1.4 at the end of the following paper, withn
equal to19, 199, 1999, ...
: m-hikari.com/ijcms-password/ijcms-password13-16-2006/… \$\endgroup\$