login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A330288 Start with the list of numbers from 1 to n. As long as the list has odd and even elements, append to the list the sum of the smallest odd and smallest even elements, taken with multiplicity, and delete these terms from the list. a(n) is the largest element in the final list. 1

%I #25 Jan 16 2020 13:25:59

%S 1,3,3,10,15,21,17,21,19,29,29,49,47,49,91,75,73,75,73,75,73,75,73,75,

%T 73,75,123,121,135,135,131,135,131,131,163,157,153,157,187,193,181,

%U 193,215,223,213,213,277,275,243,243,321,299,289,291,261,265,261,265,261

%N Start with the list of numbers from 1 to n. As long as the list has odd and even elements, append to the list the sum of the smallest odd and smallest even elements, taken with multiplicity, and delete these terms from the list. a(n) is the largest element in the final list.

%C Conjecture: a(4)=10 is the only even term. - _Jon E. Schoenfield_, Dec 28 2019

%e 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.

%t 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 *)

%o (PARI) apply( A330288(n)={ my( even=[1..n\2]*2, odd=[ 2*k-1 | k<-[1..n\/2]],

%o keep(S)=[t | t<-S, t>S[1]], s); while( even && odd,

%o s = even[1]*(#even - #even=keep(even)) + odd[1]*(#odd - #odd=keep(odd));

%o if( s%2, odd=vecsort(concat(odd,s)), even=vecsort(concat(even,s)) ));

%o if( odd, vecmax(odd), vecmax(even))}, [1..99]) \\ _M. F. Hasler_, Dec 08 2019

%K nonn

%O 1,2

%A _Ali Sada_, Dec 09 2019

%E Definition and terms corrected by _M. F. Hasler_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 18:17 EDT 2024. Contains 371962 sequences. (Running on oeis4.)