login
A167152
Lexicographically earliest injective sequence such that a(n) = A007953(a(a(n))), where A007953 = sum of digits (in base 10).
3
1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 29, 13, 49, 15, 69, 17, 89, 19, 199, 21, 399, 23, 599, 25, 799, 27, 999, 30, 2999, 3999, 32, 5999, 34, 7999, 36, 9999, 38, 29999, 40, 49999, 42, 69999, 44, 89999, 46, 199999, 48, 399999, 499999, 51, 699999, 53, 899999, 55, 1999999, 57
OFFSET
1,2
COMMENTS
"Lexicographically earliest" means that the sequence is constructed by choosing a(n) to be the smallest positive integer not leading to a contradiction; "injective" means that a number may occur only once, and is thereafter excluded from the possible choices for subsequent terms.
Open problems: (1) Prove that a(n) > n for all n > 9.
(2) Prove that the subsequence of terms not ending in "9" is strictly increasing.
(3) Prove the given formula for a(n).
(4) Find an explicit formula for indices n where a(n) = m*10^k - 1.
LINKS
Eric Angelini, a(n) is the digitsum of a(a(n)), November 2009.
Eric Angelini, a(n) is the digitsum of a(a(n)) [Cached copy, with permission]
FORMULA
If n < 10 or n is in { a(1), ..., a(n-1) }, then a(n) = (n mod 9 + 1)*10^floor(n/9) - 1 (= n for n < 10).
Otherwise, a(n) = n+1 unless n+1 occurred earlier in the sequence (and therefore is of the form k*10^m - 1), in which case a(n) = n+2 (conjectured).
PROG
(PARI) /* This code is for illustration and "experimental verification"; several important simplifications could be made to compute a(n) efficiently. */
A167152(n, output=0, u=[])={ my(a=vector(n), k); for( i=1+#u, #a, if( setsearch( u, i )
, /* this index has already appeared, so this a(n) must have that digit sum */
k= ((i % 9)+1)*10^(i\9)-1; /* this k is the smallest number with digit sum i; this should work "at once" and the loop below should not be needed */
while( sumdigits(k) != i || setsearch(u, k), k+=10^(i\9-1)*9 /*e.g. to 89 we add 9*/)
, /* index has not yet appeared: choose smallest number not yet used and not leading to contradiction */
/* is it possible that a[i] = k < i ? Clearly a[i] = i iff i <= 9, else digsum(i)<i. */
k=1; while( setsearch(u, k) || (k<=i & sumdigits(if( k<i, a[k], i)) != k), k++);
)/*end if i in u */;
output & if( #output>1, write(output, i" "k), print1(k, ", ")); u=setunion( u, Set(a[i]=k))
)/* end for i */; k}
CROSSREFS
Sequence in context: A250410 A250409 A303002 * A246008 A344823 A064704
KEYWORD
nonn,base
AUTHOR
Eric Angelini and M. F. Hasler, Nov 02 2009
EXTENSIONS
Edited by Charles R Greathouse IV, Aug 02 2010
STATUS
approved