login
A127397
a(0)=0; a(n) = smallest positive integer not occurring earlier in the sequence such that a(n-1)+a(n) = j^k, j = any positive integer, k = any integer >= 2.
4
0, 1, 3, 5, 4, 12, 13, 14, 2, 6, 10, 15, 17, 8, 19, 30, 34, 47, 53, 11, 16, 9, 7, 18, 31, 33, 48, 52, 29, 20, 44, 37, 27, 22, 42, 39, 25, 24, 40, 41, 23, 26, 38, 43, 21, 28, 36, 45, 55, 66, 59, 62, 63, 58, 67, 54, 46, 35, 65, 56, 69, 75, 50, 71, 57, 64, 61, 60, 68, 32, 49, 51, 70
OFFSET
0,3
COMMENTS
Agrees with A284048 (which requires nontrivial prime powers) for indices n = 1..17. We remark that n = 17 is the smallest integer such that one can arrange the numbers 1 through n in a cycle such that any two neighbors sum to a perfect power, and the same is possible for any larger integer. To get this cycle for n = 17, one must use insert (11, 16, 9, 7) between a(7) = 14 and a(8) = 2; then the 17th term would be the current a(13) = 8 that can be "connected" to a(1) = 1 to close the cycle. Alternatively, if one allows for terms >= 0, then the "greedy" solution starting with a(0) = 1 would have a(4) = 0 (after a(3) = 4), followed by 8, and have all integers up to 17 at a(17) = 15 that could be "connected" to a(0). - M. F. Hasler, May 05 2026
LINKS
MATHEMATICA
f[n_] := n == 1 || GCD @@ Last /@ FactorInteger[n] > 1; g[l_List] := Block[{k = 1}, While[MemberQ[l, k] || ! f[k + l[[ -1]]], k++ ]; Append[l, k]]; Nest[g, {0}, 73] (* Ray Chandler, Jan 22 2007 *)
PROG
(PARI) A127397_first(N, S=0, U=0)={vector(N, n, if(n>2, for(k=S, oo, !bittest(U, k-S)&& ispower(k+N)&& [N=k, break]), N=n-1); if(N>S, U+=1<<(N-S), S+=n=valuation(U+2, 2); U>>=n); N)} \\ M. F. Hasler, May 05 2026
CROSSREFS
Cf. A001597, A034175, A127398, A284048 (similar, requiring prime powers).
Sequence in context: A007063 A335500 A376817 * A284048 A326119 A201271
KEYWORD
nonn,look
AUTHOR
Leroy Quet, Jan 12 2007
EXTENSIONS
Extended by Ray Chandler, Jan 22 2007
STATUS
approved