Javascript Prime Factorization calculator

This javascript is used to find the prime factors of a given number and also to find the factors of given number.

Features

  • Used to find the prime factors of the given number.
  • This calculator provides factorization even for large numbers.
  • Provides easy accessibility to calculation.

Preview


Prime Factor Calculator
Enter the number:
Prime factors are:
H

Downloads

Javascript Code


<!-- Script by hscripts.com -->
<!-- More scripts @www.hscripts.com -->
<script type="text/javascript">
function factorise(numm){var newnum = numm;
var newtext = "";var chk = 2;
while (chk*chk <= newnum){ if (newnum % chk == 0){newtext = newtext + chk;
newnum = newnum/chk;
if (newnum != 1){newtext = newtext + "*";
}}else{chk++;
}}if (newnum != 1){
newtext = newtext + newnum;
}if (newtext == "" + numm){
newtext = "Prime Number:"+newtext;
}document.frm.result.value=newtext;}
</script>

<!-- Script by hscripts.com -->




HTML Code


<table align=center style='border:1px solid green;color: #3D366F;font-size:13px;'>
<form name=frm>
<tr><td>Enter the number:</td><td><input type="text" size="10" name="text1"></td></tr>
<tr><td>Prime factors are:</td><td><input type="text" size="42" name="result"></td></tr>
<tr><td colspan=2 align=center><input type="button" name="button1" value="Prime Factor" onClick="factorise(frm.text1.value)"><a href='https://www.hscripts.com' style='text-decoration:none;font-size:10;color:green;'>H</a></td></tr>
</form>
</table>


  • Release Date - 30-07-2009
  • Get free version without ©copyright link for just $10/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • Copy and paste the javascript code into your HTML page and make use of this calculator.
  • Here,the function "factorise()" provides the prime factorization of the given number.
  • This script calculates dynamically the factors of any given number.

License

Related Scripts

Free Javascript Scripts


Ask Questions

Ask Question