[go: up one dir, main page]

login
A118833
a(1) = 1. a(n) = (|a(n-1) - n| + 1)th positive integer which does not occur earlier in the sequence.
2
1, 3, 2, 6, 5, 7, 4, 12, 11, 9, 13, 10, 16, 15, 8, 24, 23, 21, 18, 19, 20, 22, 17, 31, 30, 28, 25, 29, 14, 46, 45, 43, 40, 36, 27, 42, 37, 32, 44, 38, 35, 49, 48, 41, 47, 33, 61, 60, 58, 55, 51, 34, 72, 71, 69, 66, 62, 53, 57, 52, 67, 59, 56, 70, 64, 50, 84, 83, 81, 78, 74, 54
OFFSET
1,2
COMMENTS
This sequence is likely a permutation of the integers.
LINKS
EXAMPLE
The first 8 terms of the sequence are 1,3,2,6,5,7,4,12. |a(8) - 9| + 1 = 4, so a(9) = the 4th positive integer which doesn't occur earlier in the sequence (i.e., the 4th integer in the sequence 8, 9, 10, 11, 13, 14, ...). Therefore a(9) = 11.
MATHEMATICA
Fold[Append[#1, Complement[Range[Max[#1] + (d = Abs[#1[[-1]] - #2] + 1)], #1][[d]]] &, {1}, Range[2, 72]] (* Ivan Neretin, Mar 13 2017 *)
CROSSREFS
Cf. A118834.
Sequence in context: A244987 A171417 A347740 * A268823 A046877 A067587
KEYWORD
easy,look,nonn
AUTHOR
Leroy Quet, May 01 2006
EXTENSIONS
More terms from Franklin T. Adams-Watters, Nov 28 2006
STATUS
approved