Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
unix shell programs
Name: sarvesh kumar sinha Date: April 27, 2003 at 01:37:17 Pacific OS: win mill. CPU/Ram: 128mb
Comment:
can any gentle man e mail me solution of the following problem? problem:write shell program to check whether the given number is a perfect number or not
Name: David Perry Date: April 27, 2003 at 07:06:32 Pacific
Reply:
You have two options. The first being to compare to a relatively short list fixed list of numbers that are know to be perfect. The second checks against he published math formula and is very processor intesive.
if [ $num -lt 500 ] ; then if [ $num -eq 6 -o $num 28 -o $num 496 ] ; then echo "Perfect number found" else echo "Not a perfect number" fi else echo "Sorry $num out of range" fi
0
Response Number 2
Name: David Perry Date: April 28, 2003 at 05:46:52 Pacific
Theorem: If 2k-1 is prime, then 2k-1 (2k-1) is perfect and every even perfect number has this form. It turns out that for 2k-1 to be prime, k must also be prime--so the search for Perfect numbers is the same as the search for Mersenne primes. Armed with this information it does not take too long, even by hand, to find the next two perfect numbers: 33550336 and 8589869056. See the first page on Mersennes below for a list of all know perfect numbers.
Summary: hi, i want full solution of following five as shell programe in unix- 1)to search a number in a given list of numbers. 2) to reverse a seven digit number and find the sum of all the digits. 3)to sort ...
Summary: How to pass the value in interactive mode? Example: when i run a PGP application, its asking message 'Yes' or 'NO'.But i want to pass the value 'YES' in shell Program. please help me .. Thanks ...
Summary: I'm trying to compose a unix shell program which compares files performing a diff command on edited versions of them and counting the number of lines in the output of the diff command. Basically this ...