Descrição: Apostila de Shell Script para iniciantes.
shell script for dba'sFull description
Descripción: Ejercicios Bash
Shell Script
Shell ScriptFull description
few algorithms of shell script programsFull description
Shell Script BasicoDescripción completa
Linux
Full description
love astrology
Full description
Descripción: sex of a child
Introduction of NT
Introduction of NTFull description
Full description
Introduction of NT
Introduction of NTDescription complète
Full description
Warmachine
Shell Script to Find Prime Factors of a Number
In number theory, the prime factors of a positive integer are the prime numbers that divide that integer exactly, without leaving a remainder. The process of finding these numbers is called integer factorization, or prime factorization. The fundamental theorem of arithmetic says that every positive integer has a unique prime factorization. Example: The prime factors of ! are ", , # and $$: ! % " & & # & $$ There is no other possible set of prime numbers that can be multiplied to ma'e !. (ou can find prime factors of a number using )*I+-inux utility factor. This is a very convenient and cool )*I+ command. ere is its syntax: / factor !: " / factor "$"$011:
! # $$ "$"$011 $$ $$ $ $0 1$
2any 3lgorithms have been devised for determining the 4rime factors of a given number. They vary quite a bit in sophistication and complexity. It is very difficult to build a general5purpose algorithm for this computationally 6hard6 problem, so any additional information which is 'nown about the number in question or its factors can often be used to save a large amount of time. ere I am providing a shell script to find prime factors of a positive integer. This script does most factorizations within a second. In the worst case scenario 7for some large semi5primes with
more than 85digit factors9 factorization will ta'e a couple of minutes to hours.
;binbash <=>I4T: primefactors.sh )<3?E : primefactors.sh @4ositive IntegerA 4)>4B
primenumber /counter$ FF factorchec' /$ /counter$ FF brea' done O factorchec'79 K prime%/" newnum%/$ remainder%/77newnumNprime99 if C /remainder 5eq ! D then printf 6Ndx6 /prime newnum%/77newnumprime99 primefind /newnum " return else let prime primefind /newnum /prime fi O 2ain echo 5n 64rime actors of /$: primefind /num " printf 6Qb Qn6 Qb is used for removing last x. OUTPUT:
CrootRvenu D sh primefactors.sh )sage: scriptname @positive integer%66A CrootRvenu D sh primefactors.sh "$"$0101 4rime actors of "$"$0101: $!$x"$!!01 CrootRvenu D sh primefactors.sh "$"$01 4rime actors of "$"$01: SSxS10 >unning time of script doesnPt depend on number,it depends on number of factors, more factors less time and less factors more time. CrootRvenu D time sh primefactors.sh 0000000000000000 4rime actors of 0000000000000000: xx$$x$1x1x$!$x$1x#"# real user sys
!m$.S#s !m$.""#s !m!.!0$s
CrootRvenu D time sh primefactors.sh 00000000000# 4rime actors of 00000000000#: #x"#$x$$xS#$10 real user sys
$m".$!#s $m".88s !m.$0"s
CrootRvenu D time sh primefactors.sh 00000000!!!!!!!!!
4rime actors of 00000000!!!!!!!!!: "x"x"x"x"x"x"x"x"xxx#x#x#x#x#x#x#x#x#x$$x1 x$!$x$1 real user sys