login
A207827
First line of the upper right triangle A207826: Least T[1,n]>0 such that the n-th column can be filled with T[k+1,n] = |T[k,n-1]-T[k,n]| or T[k,n-1]+T[k,n] if the former was used earlier.
2
1, 2, 4, 7, 8, 10, 13, 12, 16, 20, 19, 32, 24, 34, 29, 40, 31, 45, 52, 42, 62, 81, 46, 47, 91, 68, 111, 70, 84, 99, 61, 113, 80, 78, 125, 85, 141, 105, 102, 130, 55, 106, 142, 168, 98, 188, 135, 120, 189, 150, 157, 295, 171, 195, 178, 254, 164, 216, 212, 144
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
Sequence in context: A047540 A116478 A207829 * A047236 A371638 A039581
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 20 2012
STATUS
approved