Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate smooth numbers up to some maximum
ResourceFunction["GenerateSmoothNumbers"][max] generates all positive integers up to max whose prime factors are equal to or less than 7. | |
ResourceFunction["GenerateSmoothNumbers"][max,p] generates all positive integers up to max whose prime factors are equal to or less than p. |
Generate the numbers up to 100 that have factors that are 13 or less:
In[1]:= |
![]() |
Out[1]= |
![]() |
Generate the numbers up to 100 that have factors that are 7 or less—so-called humble numbers:
In[2]:= |
![]() |
Out[2]= |
![]() |
The second argument does not have to be an integer:
In[3]:= |
![]() |
Out[3]= |
![]() |
Check that the prime factors are all below 6.5:
In[4]:= |
![]() |
Out[4]= |
![]() |
Smooth numbers can be found by sieving:
In[5]:= |
![]() |
Out[5]= |
![]() |
The algorithm used by GenerateSmoothNumbers is much faster though:
In[6]:= |
![]() |
Out[6]= |
![]() |
The argument of GenerateSmoothNumbers can be really large—much larger than practical for a method based on sieving:
In[7]:= |
![]() |
Out[7]= |
![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License