OFFSET
1,2
COMMENTS
From Luca Zanardi Lamardo, Jan 26 2025: (Start)
The formulas for a(n) can be found by analyzing numbers (mod 99) and noticing two properties:
If n is odd, the number can only have n digits.
If n is even, any 2 digits that have n-1 digits between them must be equal. (End)
LINKS
Luca Zanardi Lamardo, Table of n, a(n) for n = 1..500
Hans Havermann, Table of A093211-A093299
Index entries for linear recurrences with constant coefficients, signature (1,10100,-10100,-1000000,1000000).
FORMULA
From Luca Zanardi Lamardo, Jan 26 2025: (Start)
a(2k+1) = 10^(2k+1) - 10, being digits 99...990 with 2k 9's.
a(2k) = 10^(4k-1)-10^(2k+1) + 10^(2k-1) - 10 for k>=2, being digits 99...990099...990 with 2k-2 9's in each of the groups of 9's. (End)
EXAMPLE
a(4) is 9900990 because its length-4 substrings (9900, 9009, 0099, 0990) are all distinct and divisible by 99 and there is no larger number with this property.
PROG
(C++)
#include <string>
using namespace std;
string a093299(int n) {
if(n == 1) return "0";
else if(n == 2) return "99";
else {
if(n % 2 == 1) return string(n - 1, '9') + "0";
else return string(n - 2, '9') + "00" + string(n - 2, '9') + "0";
}
}
CROSSREFS
KEYWORD
nonn,base,easy,changed
AUTHOR
Hans Havermann, Mar 29 2004
EXTENSIONS
a(9)-a(13) from John Cerkan, Jun 14 2017
a(14)-a(18) from Luca Zanardi Lamardo, Jan 26 2025
STATUS
approved