OFFSET
1,2
COMMENTS
This version differs from the first version A207829, where all possibilities of x+y vs |x-y| are tested in a given column, before discarding a candidate for the next element of the first line. Here a candidate a(n)=T[1,n] is discarded when successive ("greedy") choices of smallest possible elements T[k,n] (k=2, 3,...) lead (in some subsequent row k) to a situation where no choice is possible, i.e., both |T[k,n-1]-T[k,n]| and T[k,n-1]+T[k,n] appear earlier.
LINKS
E. Angelini, Tableau avec soustractions/additions, Feb 19 2012
E. Angelini, Tableau avec soustractions/additions [Cached copy, with permission]
PROG
(PARI) list_A207827(Nmax, show=1/*print out terms as they are calculated*/)={ my( u=[], lc=u, f(a, b, u) = setsearch( u, abs(a-b)) || return(abs(a-b)); !setsearch( u, a+b ) & return(a+b)); vector( Nmax, n, my(nc=vector(n)); until( nc[n], while( setsearch( u, nc[1]++), ); for( k=2, n, (nc[k] = f( nc[k-1], lc[k-1], setunion( Set( vecextract( nc, 2^(k-1)-1 )), u ))) || next(2))); u=setunion(u, Set(lc=nc)); show & print1(nc[1]", "); nc[1])}
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 20 2012
STATUS
approved