PowerRange

PowerRange[b]

generates the list {1,10,100,,max}, where max is the largest power of 10 that does not exceed b.

PowerRange[a,b]

generates the list {a,10a,100a,,max}, with successive elements increasing by factors of 10.

PowerRange[a,b,r]

uses factors of r instead of 10.

Details

  • PowerRange effectively behaves like Range, but in "log-space".
  • The arguments a and b to PowerRange need not be integers or powers of r, but must be either both positive or both negative.
  • PowerRange starts from a and successively multiplies by r until the result is larger than b.
  • If b/a is not a power of r, the endpoint b will not be included in the list generated by PowerRange.

Examples

open allclose all

Basic Examples  (2)

Generate a list of powers of 10 from 1 to 1 million:

In[1]:=
Click for copyable input
Out[1]=

Generate a list of powers of 2 less than a hundred:

In[1]:=
Click for copyable input
Out[1]=

Scope  (3)

Properties & Relations  (3)

See Also

Range  Ratios  FindDivisions  Power  Exp  RSolveValue  NestWhileList  FromDigits

Introduced in 2014
(10.0)