Closed Captioning Closed captioning available on our YouTube channel

How to use the factor command: 2-Minute Linux Tips

Network World | Nov 20, 2020

In this Linux tip, learn how to use the factor command. It’s not one that you will likely need very often, but it can be very useful when you’re doing math on the command line. It provides the factors for any number you offer as an argument.

Copyright © 2020 IDG Communications, Inc.

Similar
Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the factor command. It’s not one that you will likely need very often, but it can be very useful when you’re doing math on the command line. Just as the name implies, it provides the factors for any number you offer as an argument.
In case you haven’t thought about factors in a while, they are the prime numbers that multiplied produce the number you’re starting with. A prime number is a whole number greater than one that cannot be the result of multiplying other whole numbers.
Here’s an example:
$ factor 123
123: 3 41
$ factor 123456789
123456789: 3 3 3607 3803
The factors for 123 are 3 and 41. The factors for 123,456,789 are 3, 3, 3607 and 3803. Each of these numbers is prime. If you try to factor a number which is prime, you get nothing but the number itself.
$ factor 3803
3803: 3803
Factoring has many applications in the real world and being able to factor on the Linux command line can be very useful.
That’s your Linux tip for the factor command.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.

Featured videos from IDG.tv