push all lucas numbers below max to the set a and b are first two elements of the Lucas sequence
var s = [ ] ; var a = 2 , b = 1 , c ; s . push ( a ) ; s . push ( b ) ; while ( b < max ) { var c = a + b ; a = b ; b = c ; s . push ( b ) ; } s . sort ( ( a , b ) => a - b ) var count = 0 ; for ( var i = 0 ; i < n ; i ++ ) {