Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Search an ordered list at speed logarithmic in the length of a list
ResourceFunction["SearchOrderedList"][list] gives the index of the first element of list that is True. | |
ResourceFunction["SearchOrderedList"][list,f] gives the index of the first element of list for which f is True. |
Find the first integer which has at least 1050 partitions:
In[1]:= |
Out[1]= |
In[2]:= |
Out[2]= |
An exact match returns an integer and this happens if func returns zero on the desired element:
In[3]:= |
Out[3]= |
In this case there is no match, so SearchOrderedList says it would have fallen between elements 91 and 92:
In[4]:= |
Out[4]= |
In[5]:= |
Out[5]= |
This work is licensed under a Creative Commons Attribution 4.0 International License