filter p [100000,99999..]
calculates the list including all numbers descending from 100000 for which p returns true. head
then takes the first of that list, effectively giving you the largest number x below 100000, for which p x
returns true, i.e. for which x `mod` 3829
is 0.
What values are in p and x?
p is a function that takes one argument called x
and returns true iff x `mod` 3829 == 0
. x
is the argument given to the function. Since you use p as an argument to filter, this means that each element of the list [100000,99999..]
will be given to p in turn, until p returns true for the first time (it won't try any more elements because by using head, you're only requesting one element, so it only calculates one).