3 added 160 characters in body

This challenge involves two similar digit-based routines each of which, when given a non-negative integer seed, produce eventually periodic sequences.
The goal is to find the nth seed number (counting up) that does not define the two sequences to be the same by virtue of its obvious featuresidentical (theby virtue of the order of its digits), yet has the samedoes yield sequences of equal pre-periodic length in both resulting sequences.

Note: Ignoring the absolute part of this definition, many low bases have their iterations listed at the OEIS: base-2, base-3, base-4, base-5, base-6, base-7, base-8, base-9, base-10base-10, base-11, base-12, base-16, base-20.

Write a program or function which when provided with a numberpositive* integer, nn, and aan integer base greater than one**, bb, outputs the nthnth number (in the natural ordering) which has neither sorted nor reverse-sorted digits in the given base, b, but which doesdoes have the same pre-periodic trajectory length for both procedures defined above in the given base.

* Feel free to have the counting (i.e. nn) be 0-based if you would prefer, just say in your submission.

** Note there are no such numbers in base-1, so the code does not need to handle b=1 as an input.

This challenge involves two similar digit-based routines each of which, given a non-negative integer seed, produce eventually periodic sequences.
The goal is to find the nth seed number (counting up) that does not define the two sequences to be the same by virtue of its obvious features (the order of its digits), yet has the same pre-periodic length in both resulting sequences.

Note: Ignoring the absolute part of this definition, many low bases have their iterations listed at the OEIS: base-2, base-3, base-4, base-5, base-6, base-7, base-8, base-9, base-10, base-11, base-12, base-16, base-20.

Write a program or function which when provided with a number, n, and a base, b, outputs the nth number (in the natural ordering) which has neither sorted nor reverse-sorted digits in the given base, but which does have the same pre-periodic trajectory length for both procedures defined above in the given base.

Feel free to have the counting (i.e. n) be 0-based if you would prefer, just say in your submission.

This challenge involves two similar digit-based routines each of which, when given a non-negative integer seed, produce eventually periodic sequences.
The goal is to find the nth seed number (counting up) that does not define the two sequences to be the identical (by virtue of the order of its digits), yet does yield sequences of equal pre-periodic length.

Note: Ignoring the absolute part of this definition, many low bases have their iterations listed at the OEIS: base-2, base-3, base-4, base-5, base-6, base-7, base-8, base-9, base-10, base-11, base-12, base-16, base-20.

Write a program or function which when provided with a positive* integer, n, and an integer base greater than one**, b, outputs the nth number (in the natural ordering) which has neither sorted nor reverse-sorted digits in the given base, b, but which does have the same pre-periodic trajectory length for both procedures defined above in the given base.

* Feel free to have the counting (i.e. n) be 0-based if you would prefer, just say in your submission.

** Note there are no such numbers in base-1, so the code does not need to handle b=1 as an input.

2 added 9 characters in body

This challenge involves two similar digit-based routines each of which, given a non-negative integer seed each, produce eventually periodic sequences.
The goal is to find the nth seed number (counting up) that does not define the two sequences to be the same by virtue of its obvious features (the order of its digits), yet has the same pre-periodic length in both resulting sequences.

• Notice that we have hit a periodic part of the sequence, {67167010, 80682010, 75352510}, so the pre-periodic Kaprekar base-16 trajectory of 83638110 is fourfour:

This challenge involves two similar digit-based routines which given a non-negative integer seed each produce eventually periodic sequences.
The goal is to find the nth seed number (counting up) that does not define the two sequences to be the same by virtue of its obvious features (the order of its digits), yet has the same pre-periodic length in both resulting sequences.

• Notice that we have hit a periodic part of the sequence, {67167010, 80682010, 75352510}, so the pre-periodic Kaprekar base-16 trajectory of 83638110 is four:

This challenge involves two similar digit-based routines each of which, given a non-negative integer seed, produce eventually periodic sequences.
The goal is to find the nth seed number (counting up) that does not define the two sequences to be the same by virtue of its obvious features (the order of its digits), yet has the same pre-periodic length in both resulting sequences.

• Notice that we have hit a periodic part of the sequence, {67167010, 80682010, 75352510}, so the pre-periodic Kaprekar base-16 trajectory of 83638110 is four:
1

# Same Same But Different code-golfnumbersequencebase-conversioninteger

This challenge involves two similar digit-based routines which given a non-negative integer seed each produce eventually periodic sequences.
The goal is to find the nth seed number (counting up) that does not define the two sequences to be the same by virtue of its obvious features (the order of its digits), yet has the same pre-periodic length in both resulting sequences.

### Reverse & Absolute Difference Routine.

A reverse and difference sequence may be defined in any given base for a non-negative seed by iteratively taking the absolute difference between the number and itself with its digits reversed.

An example:

The number 54410 is 10001000002;
The reverse of which is 00000100012, which is 1710;
The difference between the two is 52710;
Repeating the process we have 52710 = 10000011112, reversed is 11110000012 = 96110, and a difference of 43410;
Repeating again, 43410 = 1101100102, reversed is 0100110112 = 15510, and a difference of 27910;
Repeating again yields 18610, then 9310, and then 0, which will continue to yield 0.

• So, the pre-periodic reversal and difference base-2 trajectory length of 54410 is six.
- since the iterative procedure may be performed six times before a periodic part, {0}, is reached:

54410, 52710, 43410, 27910, 18610, 9310, {0}

• Similarly the pre-periodic reversal and difference base-2 trajectory length of 9310 is one
...and the pre-periodic reversal and difference base-2 trajectory length of 0 is zero (as it is in any base).

Note: Ignoring the absolute part of this definition, many low bases have their iterations listed at the OEIS: base-2, base-3, base-4, base-5, base-6, base-7, base-8, base-9, base-10, base-11, base-12, base-16, base-20.

### Kaprekar Routine.

A similar, but different sequence is the Kaprekar sequence where the absolute difference above is replaced by the difference, and the reversal is preceded by a digit-sort.

An example:

The number 83638110 is CC31D16;
Which, reverse-sorted is DCC3116, which is 90424110;
And forward-sorted is 13CCD16, which is 8110110;
The reverse-sorted less the forward-sorted is then 82314010;
Repeating the process we have 82314010 = C8F6416, reverse-sorted is FC86416 = 103434010, forward sorted is 468CF16 = 28897510, and the subtraction yields 74536510;
Repeating again yields 67983010, then 67167010, then 80682010, then 75352510, then 67167010...

• Notice that we have hit a periodic part of the sequence, {67167010, 80682010, 75352510}, so the pre-periodic Kaprekar base-16 trajectory of 83638110 is four:

83638110, 82314010, 74536510, 67983010, {67167010, 80682010, 75352510}

Note:: Once again the OEIS lists the iterations for some low bases: base-2, base-3, base-4, base-5, base-6, base-7, base-8, base-9, base-10.
Furthermore some pre-periodic sequences also exist: base-2, base-3, base-4, base-5, base-6, base-7, base-8, base-9, base-10.

### Same same...

Any number whose digits are already either forward or reverse sorted in some base will have the same pre-periodic trajectory length for both sequences in that base, since the resulting procedure will be identical.

There are, however, numbers which have the same pre-periodic trajectory length in both sequences even though their digits in the base in question are not already sorted.

The first example in base-10 is 107 which has a pre-periodic trajectory length of three in both sequences:

Reverse & difference: 107, 594, 99, {0}
Kaprekar: 107, 693, 594, {495}

Aside: Any number with less than three digits will always be sorted or reverse-sorted, as will the first three digit number, so the only others to actually check in base-10 before finding 107 would be [102-106].

### The challenge

Write a program or function which when provided with a number, n, and a base, b, outputs the nth number (in the natural ordering) which has neither sorted nor reverse-sorted digits in the given base, but which does have the same pre-periodic trajectory length for both procedures defined above in the given base.

The input and output are as flexible as ever, however the input and output numbers (or string or list representations thereof) are to be in a single unchanging base, consistent between input and output - for most this will probably mean base ten, but any single base is acceptable, as long as it is consistent across any invocations of the code.

Feel free to have the counting (i.e. n) be 0-based if you would prefer, just say in your submission.

### Test cases (one-based n, IO in base-10)

 n     b  result
1     2      17
2     2      33
3     2      51
4     2      65
5     2      73
6     2      85
17     2     297

1     3      28
2     3      29
3     3      32
4     3      48
5     3      51
6     3      55
17     3     101

1    10     107
2    10     160
3    10     161
4    10     172
5    10     186
6    10     187
17    10     329

1    16     264
2    16     266
3    16     355
4    16     373
5    16     400
6    16     401
17    16     522

1   257   66179
2   257   98949
3   257   98951
4   257   98953
5   257   98955
6   257   98957
17   257   98979

1  1234 1523375
2  1234 2242181
3  1234 2243417
4  1234 2244655
5  1234 2245897
6  1234 2247147
17  1234 2260770