|
|
A234586
|
|
Odd-indexed terms are absolute values of differences.
|
|
2
|
|
|
1, 2, 1, 4, 3, 6, 1, 8, 3, 10, 5, 12, 7, 14, 5, 16, 7, 18, 5, 20, 7, 22, 5, 24, 7, 26, 9, 28, 11, 30, 9, 32, 11, 34, 13, 36, 15, 38, 13, 40, 15, 42, 17, 44, 19, 46, 17, 48, 19, 50, 17, 52, 19, 54, 17, 56, 19, 58, 21, 60, 23, 62, 21, 64, 23, 66, 21, 68, 23, 70, 21, 72, 23, 74, 25, 76, 27, 78, 25, 80, 27, 82, 25
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
The precise definition is: Set a(2n)=2n for all n, set a(1)=1, and for n >= 1 choose a(2n+1) so that the subsequence {a(2i+1), i>=0} is the same as the sequence of differences {|a(j+1)-a(j)|, j>=0}.
|
|
LINKS
|
|
|
FORMULA
|
There is a surprising connection with the Thue-Morse sequence A010060. If the k-th run of equal terms in A010060 (k>=0) has length L (L=1 or 2, see A026465), replace it by 2L copies of the pair 4k+1, 4k+3. This produces the odd-indexed terms of the sequence (ignoring the initial 1): 0 1 1 0 1 0 0 1 ... becomes 1 3 1 3 5 7 5 7 5 7 5 7 9 11 9 11 13 ... - N. J. A. Sloane, Dec 31 2013
|
|
EXAMPLE
|
We start by alternating even numbers and "holes" like this:
S = . 2 . 4 . 6 . 8 . 10 . 12 . 14 . 16 . 18 . 20 . 22 .....
We fill the first hole with '1' and the second and third holes with x, y:
S = 1 2 x 4 y 6 . 8 . 10 . 12 . 14 . 16 . 18 . 20 . 22 .....
The absolute values of differences are 1, |x-2|, |4-x|, ... which must equal 1, x, y, ..., which forces x=1, y=3. And so on.
|
|
MAPLE
|
with(LinearAlgebra): M:=1000; S:=Array(1..2*M); S[1]:=1; S[3]:=1;
for i from 1 to M do S[2*i]:=2*i; od:
for i from 2 to M-1 do S[2*i+1]:=abs(S[i+2]-S[i+1]); od:
[seq(S[i], i=1..2*M)];
|
|
MATHEMATICA
|
a[1] = a[3] = 1; a[n_?EvenQ] := n; a[n_] := a[n] = Abs[a[(n-1)/2+2]-a[(n-1)/2+1]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 13 2015 *)
|
|
PROG
|
(Haskell)
import Data.List (transpose)
a234586 n = a234586_list !! (n-1)
a234586_list = concat (transpose [a234587_list, [2, 4 ..]])
a234587_list = 1 : 1 : (drop 2 $
map abs $ zipWith (-) a234586_list $ tail a234586_list)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|