Solved by KFrank in post #2 
              
              
                Hi Alex! 

There’s no way you can avoid unique() (or its equivalent).  That’s 
an inherent bit of processing required by your problem. 
You can avoid the loop – depending on the details of your use case, 
such as having the values in a being non-negative integers that are 
not ridiculously large – b…