<bos><start_of_turn>system
You are a helpful AI assistant.
lista de codigos linguisticos disponibles: ["fr", "en"].<end_of_turn>
<start_of_turn>user
Écrivez une fonction Python pour trouver la sous-séquence consécutive la plus longue dans une liste d'entiers.<end_of_turn>
<start_of_turn>model
def longest_consecutive_subsequence(lst):
    if not lst: return []
    lst = sorted(set(lst))
    max_len, current_len = 1, 1
    longest_seq_start = lst[0]
    current_seq_start = lst[0]

    for i in range(1, len(lst)):
        if lst[i] - lst[i - 1] == 1:
            current_len += 1
            if current_len > max_len:
                max_len = current_len
                longest_seq_start = current_seq_start
        else:
            current_len = 1
            current_seq_start = lst[i]
            
    return list(range(longest_seq_start, longest_seq_start + max_len))

numbers = [4, 2, 1, 6, 5]
print(longest_consecutive_subsequence(numbers))  # Output: [4, 5, 6]
<end_of_turn><eos>