Function Repository Resource:

Composite

Source Notebook

Get the nth composite number

Contributed by: Kyle Martin

ResourceFunction["Composite"][n]

gives the nth composite number.

Details and Options

A composite number is an integer that is greater than 1 and not prime.
ResourceFunction["Composite"][1] is 4.
ResourceFunction["Composite"] automatically threads over lists.

Examples

Basic Examples (3) 

The first 20 composites:

In[1]:=
Table[ResourceFunction["Composite"][n], {n, 20}]
Out[1]=

The billionth composite:

In[2]:=
ResourceFunction["Composite"][10^9]
Out[2]=

Plot the sequence:

In[3]:=
DiscretePlot[ResourceFunction["Composite"][n], {n, 100}]
Out[3]=

Publisher

Kyle Martin

Version History

  • 1.0.0 – 12 July 2019

License Information