Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

factor(1) [opensolaris man page]

factor(1)							   User Commands							 factor(1)

NAME
factor - obtain the prime factors of a number SYNOPSIS
factor [integer] DESCRIPTION
factor writes to standard input all prime factors for any positive integer less than or equal to 10^14. The prime factors are written the proper number of times. If factor is used without an argument, it waits for an integer to be entered. After entry of the integer, it factors it, writes its prime factors the proper number of times, and then waits for another integer. factor exits if a 0 or any non-numeric character is entered. If factor is invoked with an argument (integer), it writes the integer, factors it and writes all the prime factors as described above, and then exits. If the argument is 0 or non-numeric, factor writes a 0 and then exits. The maximum time to factor an integer is proportional to sqrt(n), where n is the integer which is entered. factor will take this time when n is prime or the square of a prime. OPERANDS
integer Any positive integer less than or equal to 10^14. EXIT STATUS
0 Successful completion. 1 An error occurred. DIAGNOSTICS
factor prints the error message Ouch! for input out of range or for garbage input. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.11 31 Jan 1996 factor(1)

Check Out this Related Man Page

factor(1)							   User Commands							 factor(1)

NAME
factor - obtain the prime factors of a number SYNOPSIS
factor [integer] DESCRIPTION
factor writes to standard input all prime factors for any positive integer less than or equal to 10**14. The prime factors are written the proper number of times. If factor is used without an argument, it waits for an integer to be entered. After entry of the integer, it factors it, writes its prime factors the proper number of times, and then waits for another integer. factor exits if a 0 or any non-numeric character is entered. If factor is invoked with an argument (integer), it writes the integer, factors it and writes all the prime factors as described above, and then exits. If the argument is 0 or non-numeric, factor writes a 0 and then exits. The maximum time to factor an integer is proportional to sqrt(n), where n is the integer which is entered. factor will take this time when n is prime or the square of a prime. OPERANDS
integer Any positive integer less than or equal to 10**14. EXIT STATUS
0 Successful completion. 1 An error occurred. DIAGNOSTICS
factor prints the error message Ouch! for input out of range or for garbage input. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.10 31 Jan 1996 factor(1)
Man Page

13 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check for a valid numeric input

Hi Folks, I'm using bash script. I would like to check whether input is a number or not.(Only positive numbers).. if space or non numeric is entered, it should say "invalid input". pls help.. thanks in adv. Br/// Vijay. (1 Reply)
Discussion started by: Vijayakumarpc
1 Replies

2. Shell Programming and Scripting

While Do Loops Problems

So i'm coding this loop for a class I have. I think it goes without saying that I don't have much experience with this. This loops is supposed to check the input entered by the user. If it's entered in the command line then it checks the validity of the data entered, if it's not entered on the cmd... (1 Reply)
Discussion started by: DKNUCKLES
1 Replies

3. Shell Programming and Scripting

need the solution

Write a program to print all prime numbers from 1 to 300. (3 Replies)
Discussion started by: paniruddha
3 Replies

4. Shell Programming and Scripting

Checking input for being numeric and integers

Hi, I'm trying to check to see that the arguments given to my script are both numeric and positive integers. I'm using tcsh. I figured out the positive part, but I am having trouble with the arguments being numeric and integers I have no idea where to get started with the checking them actually... (1 Reply)
Discussion started by: mistykz
1 Replies

5. Shell Programming and Scripting

prime armi con sed e awk

Salve sono alle prime prese con i comandi sed e awk. Nel primo caso vorrei creare uno script in cui viene estratto la partizione maggiore. in pił ci deve essere un messaggio d'avviso se supera l' 80 % dello spazio occupato. Ho pensato di usare il comando df -h, e l' awk. Mi potete dire come?... (1 Reply)
Discussion started by: L_92
1 Replies

6. Programming

Anyone wanna write this?

Write a function named isPrime which accepts one integer parameter, say x. Have the function return TRUE if x is a prime. Otherwise, have it return FALSE. b) Write a program that keeps asking the user for an integer say k. As long as k is greater than 0, the program will call... (1 Reply)
Discussion started by: KyleBucket
1 Replies

7. Homework & Coursework Questions

question on shell script

hiiiiiiiiiiiii,,I found an error on my following script but couldnt find it!!! Can you please help me as soon as possible?! echo "enter a number " read n i=0 first=0 second=1 result=0 prime="true" echo –n " $first $second " while do result=`expr $first + $second` first=$second... (10 Replies)
Discussion started by: moonlips
10 Replies

8. UNIX for Dummies Questions & Answers

factor [start[stop]

Another question for you guys! This is so fun. So I am playing around with the factor operation. I read in "man factor" that you can actually print a list of primes in between a range, using the syntax factor ] However, every time I enter two values, it just returns the factored value.... (1 Reply)
Discussion started by: statichazard
1 Replies

9. Programming

Program in parallel

Hi all I need to write a parallel program which is performs the operations below for each integer number in the range of 1 to 10000 and also: 1. Find out if the numbers are prime or square numbers. 2. Display the prime numbers in an array 3. Display the square numbers in a different array... (12 Replies)
Discussion started by: bestb
12 Replies

10. Programming

Program wont print prime numbers

The problem I'm having is that when you put in the two numbers the answer is just prime.... nothing. I cannot figure this out ive been working on this forever, can someone please god just tell me how to fix this without encrypted "hints". #include <iostream> #include <cmath> using... (3 Replies)
Discussion started by: c++newb
3 Replies

11. UNIX for Dummies Questions & Answers

Memory allocation problem

I am using ubuntu. I have written a program to calculate prime factors. it works perfectly fine till entered number is less than 9989 (or so ) but when one enters a number higher than that, for example 15000, it does not work. Can anyone guide me whats the problem ? although new codes are welcome,... (2 Replies)
Discussion started by: Abhishek_kumar
2 Replies

12. Shell Programming and Scripting

Code exits before completing

The lines in bold check the value of a user input, if it is not one of the expected genes (GJB2, MECP2, PHOX2B), the user is shown a list of formats to use and the variant is entered. It is then supposed to printf that entered variant? Thank you :). name() { printf "\n\n" printf... (2 Replies)
Discussion started by: cmccabe
2 Replies

13. UNIX for Beginners Questions & Answers

How do I use grep to grab prime number output from my factor program?

I have a factor program that runs and outputs to stdout all the prime numbers that are specified in the given paramters, in this case 30000000-31000000. Command: factor/factor 30000000-31000000 Sample output: 30999979 = 30999979 30999980 = 2^2 5 11 140909 30999981 = 3 10333327... (6 Replies)
Discussion started by: steezuschrist96
6 Replies