OFFSET
1,4
EXAMPLE
MAPLE
A064389 := proc(nmax) local a, n, adiff, newa ; a := [1] ; for n from 2 to nmax do adiff := n ; while true do newa := op(-1, a)-adiff ; if newa >0 and not newa in a then a := [op(a), newa] ; break ; fi ; newa := op(-1, a)+adiff ; if newa >0 and not newa in a then a := [op(a), newa] ; break ; fi ; adiff := adiff+1 ; od ; od ; RETURN(a) ; end: A064389b := proc(a) local n, hei ; hei := [0] ; for n from 2 to nops(a) do hei := [op(hei), op(-1, hei)+sign(op(n, a)-op(n-1, a))] ; od ; RETURN(hei) ; end: inList := proc(list, n) local i ; for i from 1 to nops(list) do if op(i, list) = n then RETURN(i) ; fi ; od ; RETURN(-1) ; end: A078758 := proc(a064389) local a, n, i ; a := [] ; n :=1 ; while true do i := inList(a064389, n) ; if i < 0 then RETURN(a) ; else a := [op(a), i] ; n := n+1 ; fi ; od ; end: nmax := 1800 : a064389 := A064389(nmax) : a078758 := A078758(a064389) : b := A064389b(a064389) : for n from 1 to nops(a078758) do printf("%d, ", op(op(n, a078758), b)) ; od;
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
R. J. Mathar, Feb 12 2007
STATUS
approved