def multimap(value, f, count):
    result = [] if count < 1 else [f[value]] + [None] * (count - 1)
for i in range(1, count):
    result[i] = f[result[i - 1]]
return result
Multi-mapping a value while saving intermediate values