OFFSET
1,2
COMMENTS
Conjecture: a(n) always exists.
When n is odd a(n) is equal to 2^k or 2^k-n for a suitable k. - Giovanni Resta, Aug 07 2017
Apparently, a(n) = A110968(n-1) - 1 for n >= 3. - Hugo Pfoertner, Jun 17 2024
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..315
Robert G. Wilson v, Table of n, a(n) for n = 1..1000, or 0 if no such number is known.
EXAMPLE
a(1) = 1 since 2 - 1 = 1;
a(2) = 5 since 7 - 5 = 2;
a(3) = 13 since 16 - 13 = 3;
a(4) = 19 since 23 - 19 = 4;
a(5) = 32 since 37 - 32 = 5; etc.
MATHEMATICA
nxt[n_] := nxt[n] = Block[{k = n + 1}, While[! PrimePowerQ@k, k++]; k]; prv[n_] := prv[n] = Block[{k = n - 1}, While[! PrimePowerQ@k, k--]; k]; f[n_] := Block[{d = 0, exp = 2, p, q}, While[d == 0, p = prv[2^exp]; q = nxt[2^exp]; If[n == 2^exp - p, d = p]; If[n == q - 2^exp, d = 2^exp]; exp++]; d]; Do[ t[n] = f[n], {n, 3, 99, 2}]; p = 1; q = 2; t[_] = 0; While[p < 1110000, d = q - p; If[t[d] == 0, t[d] = p]; p = q; q = nxt@ q]; t@# & /@ Range@ 100
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Aug 04 2017
EXTENSIONS
a(13)-a(34) from Giovanni Resta, Aug 07 2017
STATUS
approved