I came across this answer who said there is a "fancy discrete maths to do it faster" than O(n^2). I cannot understand how the question linked can be done in under O(n^2).
How would I approach this problem with discrete to try and understand a faster solution?
Task description:
Find the number of "lucky triples" in a list. "Lucky triple" is defined as "In a list lst, for any combination of triple like (lst[i], lst[j], lst[k]) where i < j < k, where lst[i] divides lst[j] and lst[j] divides lst[k].