OFFSET
1,1
COMMENTS
The sequence looks like a realization of a sequence of independent random variables x(n), with probability function P(x(n) = i) = 1/(n+2), i=0..n+1. The sequence (a(n)+1)/(n+3) seems to be a good U(0,1) pseudo-random number generator.
Conjectures: -1 < a(n) < n+2; If a(n) = n+1 then a(n+1) = 0; All integers >1 occur in the sequence; For each c in [0,1] there exists a subsequence a(i_j) with (a(i_j)+1)/(i_j+3)-> c, j->infinity.
a(A241671(n)) = 0; a(A241887(n)) = n and a(m) <> n for m < A241887(n). - Reinhard Zumkeller, Aug 09 2014
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Klaus Strassburger, Plot of points [n, A065806(n)], n=1..20000
Klaus Strassburger, Plot of points [n,(A065806(n)+1)/(n+3)], n=1..20000
MAPLE
N := 2000: b := array(-N..N, [seq(i, i=-N..N)]): s := 0; for i from 0 to N do; j := (b[i]-b[i-1]); s := s+1; a[s] := j+1; if j > N or j < -N then break; end if; c := b[i]; b[i] := b[j]; b[j] := c; end do: a := [seq(a[l], l=1..s)];
MATHEMATICA
n = 2000; Clear[b]; b[i_] := b[i] = i; s = 0; For[i = 0, i <= n, i++, j = b[i] - b[i-1]; s++; a[s] = j+1; If[j > n || j < -n, Break[]]; c = b[i]; b[i] = b[j]; b[j] = c]; Table[a[l], {l, 1, s}] (* Jean-François Alcover, Sep 19 2016, adapted from Maple *)
PROG
(Haskell) following the Maple program
import Data.IntMap (empty, findWithDefault, insert)
a065806 n = a065806_list !! (n-1)
a065806_list = f 0 empty where
f i m = (j + 1) : f (i + 1) (insert i (b j) $ insert j bi m) where
j = bi - b (i - 1)
bi = b i
b x = findWithDefault x x m
-- Reinhard Zumkeller, Aug 09 2014
CROSSREFS
KEYWORD
easy,nice,nonn
AUTHOR
Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Nov 21 2001
STATUS
approved