OFFSET
1,2
COMMENTS
A variant of A267299, in contrast to which this appears to be a permutation of the positive integers.
The numbers that remain for a long time the least unused numbers are those which are close to the beginning of a large prime gap. For example, the number 1326 remains the smallest unused number because it is followed by a prime, 1327 (but until 10^4 there is no number whose digital sum would yield 1) and then a large gap to the next prime, 1361: This gap of 61-26 = 35 must equal to the digital sum of the preceding term, but the least such number is 8999 which occurs only as a(8891). The subsequenct "late bird" is 4826, which is again too close to the next prime, 4831 (the number 5000 occurred earlier so the digital sums are >= 6 until 10^4), and again at distance 35 from the subsequent prime, 4861, so the next possible predecessor is 9899 = a(9779). Similarly, the primes following 6912 are at distance 5 and 35, whence this remains the smallest unused number beyond n = 10^4.
LINKS
M. F. Hasler, Table of n, a(n) for n = 1..10000
J. Mason, M. F. Hasler, in reply to E. Angelini, A light variation, SeqFan list, Jan. 20, 2016
PROG
(PARI) A267308(n, show=0, a=1, u=0, L=1)={for(n=2, n, show&&print1(a", "); bittest(u+=1<<(a-L), 0)&&u>>=-L+L+=valuation(u+1, 2); a=sumdigits(a); for(k=L, 9e9, !bittest(u, k-L)&&isprime(k+a)&&(a=k)&&break)); if(type(show)=="t_VEC", [a, L, u], a)}
CROSSREFS
KEYWORD
nonn,base
AUTHOR
John Mason and M. F. Hasler, Jan 20 2016
STATUS
approved