Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

factor(1) [v7 man page]

FACTOR(1)						      General Commands Manual							 FACTOR(1)

NAME
factor, primes - factor a number, generate large primes SYNOPSIS
factor [ number ] primes DESCRIPTION
When factor is invoked without an argument, it waits for a number to be typed in. If you type in a positive number less than 256 (about 7.2e16) it will factor the number and print its prime factors; each one is printed the proper number of times. Then it waits for another number. It exits if it encounters a zero or any non-numeric character. If factor is invoked with an argument, it factors the number as above and then exits. Maximum time to factor is proportional to sqrt(n) and occurs when n is prime or the square of a prime. It takes 1 minute to factor a prime near 1014 on a PDP11. When primes is invoked, it waits for a number to be typed in. If you type in a positive number less than 256 it will print all primes greater than or equal to this number. DIAGNOSTICS
`Ouch.' for input out of range or for garbage input. FACTOR(1)

Check Out this Related Man Page

FACTOR(6)							 BSD Games Manual							 FACTOR(6)

NAME
factor, primes -- factor a number, generate primes SYNOPSIS
factor [-h] [number ...] primes [-h] [start [stop]] DESCRIPTION
The factor utility will factor positive integers. When a number is factored, it is printed, followed by a ':', and the list of factors on a single line. Factors are listed in ascending order, and are preceded by a space. If a factor divides a value more than once, it will be printed more than once. When factor is invoked with one or more arguments, each argument will be factored. When factor is invoked with no arguments, factor reads numbers, one per line, from standard input, until end of file or error. Leading white-space and empty lines are ignored. Numbers may be preceded by a single '+'. Numbers are terminated by a non-digit character (such as a newline). After a number is read, it is factored. The primes utility prints primes in ascending order, one per line, starting at or above start and continuing until, but not including stop. The start value must be at least 0 and not greater than stop. The stop value must not be greater than the maximum. The default and maximum value of stop is 3825123056546413050. When the primes utility is invoked with no arguments, start is read from standard input and stop is taken to be the maximum. The start value may be preceded by a single '+'. The start value is terminated by a non-digit character (such as a newline). DIAGNOSTICS
negative numbers aren't permitted illegal numeric format start value must be less than stop value Result too large BUGS
factor cannot handle the ``10 most wanted'' factor list, primes will not get you a world record. primes is unable to list primes between 3825123056546413050 and 18446744073709551615 since it relies on strong pseudoprime tests after siev- ing, and nobody has proven how many strong pseudoprime tests are required to prove primality for integers larger than 3825123056546413050. BSD
October 10, 2002 BSD
Man Page

14 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

My partition disappeared!!!! URGENT!! (newbie factor)

I just inst freeBSD boot installation and it didnt work for(probably my lack of knowledge) reasons but i now have to partitions in freeBSD and i really need them back for windows at the moment. i just cant find them. The bad thing is that i only got this bundled version of windows so i cant really... (2 Replies)
Discussion started by: riwa
2 Replies

2. UNIX for Dummies Questions & Answers

Factorize some rows in a column

HI! I have a file containing a column of numbers with 69 rows. I won't to factorize row 20 to 50 with 1.03 How do I do that? (I'm a beginner as you easily can understand) (5 Replies)
Discussion started by: frebo
5 Replies

3. Programming

Compiling multiple cpp files (abstract factory pattern)

Hi all, I have been working with java for awhile and because of my school projects I needed to switch C++. I tried to implement some patterns in C++ but unfortunately I couldn't. Specifically, I tried to implement abstract factory pattern but since I used separated files (habitual behavior from... (4 Replies)
Discussion started by: SaTYR
4 Replies

4. Shell Programming and Scripting

get positive number n as argument script must calculate the factorial of its argument

Can someone please help me with this SHELL script? I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1. Here is a start but I have no clue how to... (3 Replies)
Discussion started by: I-1
3 Replies

5. Shell Programming and Scripting

BASH: Factorial using FOR loop not working

Hi, I am trying to run the factorial script but it’s not working. The code is mentioned below: ------------------------------------------------------------------ /home/gc> cat fact.sh #!/bin/bash # using one command line parameter factorial=1 for (( number = 1; number <= $1 ;... (3 Replies)
Discussion started by: Technext
3 Replies

6. Shell Programming and Scripting

Factorial of any number using functions

how to write the code for factorial of any number using functions and arguments????? (7 Replies)
Discussion started by: kullu
7 Replies

7. Homework & Coursework Questions

Refactoring via SHELL utilities

I am completely new to Shell scripting and I have almost no idea what I'm doing here. I'm not a stranger at all to programming, but the way SHELL is done drives me to insanity. Here's my current issue: 1. We are to create a BASH script called rafactor.sh This program takes in two (or three)... (6 Replies)
Discussion started by: Okysho
6 Replies

8. Shell Programming and Scripting

shell, read table and write the value for each factor to output

Hey guyz, I have a table like this: 1 A=#;B=#;C=# 2 A=#;C=#;D=#;E=#;E=# 3 B=#;B=#;B=#;D=# # are just some numbers. I want to have the output like this: * 1 2 3 A # # NA B # NA # C # # NA D NA # # E NA # NA So basically, I wanna know in each of the rows in my input (which... (9 Replies)
Discussion started by: @man
9 Replies

9. Shell Programming and Scripting

README: Factorial quick chart with sed & bc:

Hi all, While doing some checks I found a kind of interesting arithmetic factorial chart with sed, sharing this may be simple but thought to share, # n=20;for i in `seq $n`;do printf "`seq $i|xargs|sed 's/ /*/g'`= ";echo "`seq $i|xargs|sed 's/ /*/g'`"| bc;done 1= 1 1*2= 2 1*2*3= 6... (6 Replies)
Discussion started by: rveri
6 Replies

10. Shell Programming and Scripting

Help on writing data from 2 different files to one based on a common factor

Hello all, I have 2 text files. For example: File1.txt contains data A B C D ****NEXT**** X Y Z ****NEXT**** L M N and File2.txt contains data (13 Replies)
Discussion started by: vat1kor
13 Replies

11. HP-UX

Multi-factor authentication

Is anyone here familiar with implementing multi-factor authentication on HP-UX 11.31? Either with a PIV card, or with an RSA token? We've been tasked with implementing this on our servers, but I'm not finding much in the way of products or information. To complicate matters, our servers are... (6 Replies)
Discussion started by: lupin..the..3rd
6 Replies

12. 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

13. Solaris

T4-2 - Memory DIMM issue - ldom config resets to factory-default

Which basically means the ldoms that were on there are not starting (not even showing). If I do ldm list-config it shows live config as next reboot. But, of course, next reboot it reverts back to factory default again. I must admit I'm wondering if its doing this becasue (with the... (3 Replies)
Discussion started by: psychocandy
3 Replies

14. Linux

Setting Up Google 2F Authentication for Automated (Crontab) rsync

Dear All, I have Google Two Factor (2F) Authentication enabled for sshd on most of my Linux servers. This works well and I highly recommend it. My question is: Has anyone set this up for rsync which runs in a crontab? For example, supposed we have this simple crontab script: ... (5 Replies)
Discussion started by: Neo
5 Replies