|
|
A309252
|
|
a(n) is the least number not in the sequence so far and whose absolute difference from a(n-1) is not in the sequence so far, with a(1) = 1 and a(2) = 2.
|
|
0
|
|
|
1, 2, 5, 8, 4, 7, 10, 13, 16, 19, 22, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 53, 56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98, 101
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
a(n) (mod 3) != 0;
a(n) >= n except for n= 5, 12, 26, 54, 110, 222, 446, 894, ...;
a(n) < 2n except for n= 4, 11, 25, 53, 109, 221, 445, 893, ...;
First occurrence of k or 0 if impossible: 1, 2, 0, 5, 3, 0, 6, 4, 0, 7, 12, 0, 8, 13, 0, 9, 14, 0, 10, 15, 0, 11, 16, 0, 26, 17, 0, 27, 18, 0, ..., .
|
|
LINKS
|
|
|
EXAMPLE
|
a(3) cannot be 3 since 3-2 = 1 which is a(1), it cannot be 4 since 4-2 = 2 which is a(2), but a(3) can be 5.
|
|
MAPLE
|
b:= proc(n) option remember; n in {1, 2} end:
a:= proc(n) option remember; local k, t; if n<3 then n
else t:= a(n-1); for k while b(k) or
b(abs(k-t)) do od; b(k):= true; k fi
end:
|
|
MATHEMATICA
|
a[n_] := a[n] = Block[{b = a[n -1], k = 3, s = Array[a, n -1]}, While[ MemberQ[s, k] || MemberQ[s, Abs[b -k]], k++]; k]; a[1] = 1; a[2] = 2; Array[a, 70]
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|