OFFSET
1,2
COMMENTS
Conjecture: a(4)=10 is the only even term. - Jon E. Schoenfield, Dec 28 2019
EXAMPLE
To find a(8), create the list {1, 2, 3, 4, 5, 6, 7, 8}. Remove from this list the least odd element (1) and the least even element (2) and insert their sum 1 + 2 = 3, to get the new list {3, 3, 4, 5, 6, 7, 8}. The least odd element (3) is present twice, the least even element (4) once. Remove all these from the list and insert their sum, 3 + 3 + 4 = 10, to get the new list {5, 6, 7, 8, 10}. Now, the least odd element is 5 and the least even element is 6. Add them to get the list {7, 8, 10, 11}. Now, replace 7 and 8 with their sum and the list becomes {10, 11, 15}. Replace 10 and 11 with their sum and the list becomes {15, 21}. There is no even element left, so a(8) = 21, the largest element in the list.
MATHEMATICA
Array[FixedPoint[If[AnyTrue[{#2, #3}, ! IntegerQ@ # &], {Max@ #1}, Sort@ {Delete[#1, #3], #2} & @@ {#1, #2 Count[#1, #2] + #3 Count[#1, #3], Position[#1, k_ /; ! FreeQ[{#2, #3}, k]]}] & @@ {#, SelectFirst[#, OddQ], SelectFirst[#, EvenQ]} &, Range@ #][[1]] &, 59] (* Michael De Vlieger, Dec 14 2019 *)
PROG
(PARI) apply( A330288(n)={ my( even=[1..n\2]*2, odd=[ 2*k-1 | k<-[1..n\/2]],
keep(S)=[t | t<-S, t>S[1]], s); while( even && odd,
s = even[1]*(#even - #even=keep(even)) + odd[1]*(#odd - #odd=keep(odd));
if( s%2, odd=vecsort(concat(odd, s)), even=vecsort(concat(even, s)) ));
if( odd, vecmax(odd), vecmax(even))}, [1..99]) \\ M. F. Hasler, Dec 08 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Ali Sada, Dec 09 2019
EXTENSIONS
Definition and terms corrected by M. F. Hasler
STATUS
approved