How can I implement a function that applied to that list gives me the minimal group of elements, which if repeated n times generates that list?
e.g.
a = [1,2,3,4,1,2,3,4,1,2,3,4]
foo(a)
returns [1,2,3,4]
a = [1,1,1,1]
foo(a)
returns [1]
a = [1,2,3,4,5,6]
foo(a)
returns [1,2,3,4,5,6]
EDIT
in other words this function needs to find the germ (see the solution below), a group of elements whose mere repetition generates the list exactly as it is.
A duplicates reduction function would not suffice because, for instance, [1,2,1,1] would become [1,2].