def fibonacci(n):
    """
    Generate a list of fibonacci numbers up to and including n.
    """
    result = [1, 1]
    if n <= 2:
        return result[0:n]
    counter = 2
    while True:
        next_fib = result[counter-2] + result[counter-1]
        if next_fib > n:
            break
        result.append(next_fib)
        counter += 1
    return result