Function Repository Resource:

WastefulNumberQ

Source Notebook

Test whether an integer is a wasteful number

Contributed by: Sander Huisman

ResourceFunction["WastefulNumberQ"][n]

gives True if n has fewer digits than the number of digits in its prime factorization (including exponents).

Details and Options

A number n is said to be wasteful if it has fewer digits than the number of digits in its prime factorization (including the number used for the powers).
Wasteful numbers are also called extravagant numbers.
ResourceFunction["WastefulNumberQ"] has the attribute Listable.
The powers for numbers that are raised to the power of 1 are not counted (e.g. 71=7).
For negative numbers, the minus is ignored.

Examples

Basic Examples (2) 

Test whether 8 is a wasteful number:

In[1]:=
ResourceFunction["WastefulNumberQ"][8]
Out[1]=

Test whether 10 is a wasteful number:

In[2]:=
ResourceFunction["WastefulNumberQ"][10]
Out[2]=

Scope (2) 

Test multiple numbers at once:

In[3]:=
ResourceFunction["WastefulNumberQ"][{3, 4, 10, 15, 18}]
Out[3]=

Test a negative number:

In[4]:=
ResourceFunction["WastefulNumberQ"][-10]
Out[4]=

Properties and Relations (1) 

For negative numbers, the sign is ignored:

In[5]:=
ResourceFunction["WastefulNumberQ"][-Range[1000]] === ResourceFunction["WastefulNumberQ"][Range[1000]]
Out[5]=

Neat Examples (1) 

Find all the wasteful numbers up to 1000 and plot them:

In[6]:=
Flatten[Position[ResourceFunction["WastefulNumberQ"][Range[1000]], True]] // ListPlot
Out[6]=

Publisher

SHuisman

Version History

  • 1.0.0 – 03 July 2019

License Information