|
Search: id:A100707
|
|
|
| A100707 |
|
a(1) = 1; for n > 1, a(n+1)=a(n)-k if there exists a positive number k (take the smallest) that has not yet been used and is such that a(n+1) is new and >0, otherwise a(n+1) = a(n)+k if the same conditions are satisfied. |
|
+0 4
|
|
| 1, 2, 4, 7, 3, 8, 14, 6, 13, 22, 12, 23, 11, 24, 10, 25, 9, 26, 5, 27, 45, 21, 40, 20, 43, 18, 44, 17, 46, 16, 47, 19, 51, 15, 48, 82, 42, 77, 39, 76, 37, 78, 36, 79, 35, 80, 33, 81, 32, 83, 31, 84, 34, 89, 30, 86, 29, 87, 147, 85, 146, 75, 138, 74, 139, 73, 140
(list; graph; listen)
|
|
|
OFFSET
|
1,2
|
|
|
COMMENT
|
A sequence of distinct natural numbers with property that absolute successive differences are distinct.
A more long-winded definition: start with a(1) = 1. We keep a list of the numbers k have been used as differences so far; initially this list is empty. Each difference can be used at most once.
Suppose a(n) = M. To get a(n+1), we subtract from M each number k < M that has not yet been used, starting from the smallest. If for any such k, M-k is a number not yet in the sequence, set a(n+1) = M-k, and mark the difference k as used.
If no k works, then we add each number k that has not yet been used to M, again starting with the smallest. When we find a k such that M+k is a number not yet in the sequence, we set a(n+1) = M+k, and mark k as used. Repeat.
The main question is: does every number appear in the sequence?
|
|
EXAMPLE
|
1 -> 1+1 = 2, and k=1 has been used as a difference.
2 -> 2+4 = 4, and k=2 has been used as a difference.
4 could go to 4-3 = 1, except 1 has already appeared in the sequence; so 4 -> 4+3 = 7, and k=3 has been used as a difference.
7 -> 7-4 = 3 (for the first time we can subtract) and k=4 has been used as a difference. And so on.
|
|
CROSSREFS
|
Similar to Murthy's sequence A093903, Cald's sequence (A006509) and Recaman's sequence A005132. See also A081145, A100709 (another version). Cf. A100708 (the successive differences associated with this sequence).
Sequence in context: A139696 A084332 A081145 this_sequence A078943 A063733 A141330
Adjacent sequences: A100704 A100705 A100706 this_sequence A100708 A100709 A100710
|
|
KEYWORD
|
nonn,easy,nice
|
|
AUTHOR
|
njas and Vinay Vaishampayan, Dec 10 2004
|
|
|
Search completed in 0.002 seconds
|