Prime Factorization Calculator

Prime Factorization is evaluated from Positive Integer. The calculation reports Prime Factorization, Prime or Composite? and Number of Divisors.

Results

Thanks — we’ve logged this for review.

About the Prime Factorization Calculator

Prime Factorization is treated here as a quantitative relation between Positive Integer and Prime Factorization, Prime or Composite?, Number of Divisors and Sum of All Divisors.

The calculator uses a multi formula configuration. Each reported value is read as a direct evaluation of the stored rules with the declared field formats and units.

Formula basis:
0 = _n = Math.trunc(Math.abs(parseFloat(number))); _factors = []; _temp = _n; for (var _p = 2; _p * _p <= _temp; _p++) { while (_temp% _p === 0) { _factors.push(_p); _temp = _temp / _p; } } if (_temp > 1) _factors.push(_temp); _map = {}; for (var _i = 0; _i < _factors.length; _i++) { var _f = _factors[_i]; _map[_f] = (_map[_f] || 0) + 1; } _div_count = 1; _sum_div = 1; var _keys = Object.keys(_map); for (var _k = 0; _k < _keys.length; _k++) { var _kk = parseInt(_keys[_k]); var _e = _map[_keys[_k]]; _div_count = _div_count * (_e + 1); var _seg = 0; for (var _j = 0; _j <= _e; _j++) _seg += Math.pow(_kk, _j); _sum_div = _sum_div * _seg; } _fact_str = _keys.map(function(k){ return _map[k] > 1 ? k + '^' + _map[k]: k; }).join(' x '); _is_prime = (_factors.length === 1 && _factors[0] === _n)

Interpret the outputs in the order shown by the result fields. Optional inputs affect only the outputs that depend on those variables.

Formula & How It Works

The calculation applies the following relations exactly as recorded in the metadata:

0 = _n = Math.trunc(Math.abs(parseFloat(number))); _factors = []; _temp = _n; for (var _p = 2; _p * _p <= _temp; _p++) { while (_temp% _p === 0) { _factors.push(_p); _temp = _temp / _p; } } if (_temp > 1) _factors.push(_temp); _map = {}; for (var _i = 0; _i < _factors.length; _i++) { var _f = _factors[_i]; _map[_f] = (_map[_f] || 0) + 1; } _div_count = 1; _sum_div = 1; var _keys = Object.keys(_map); for (var _k = 0; _k < _keys.length; _k++) { var _kk = parseInt(_keys[_k]); var _e = _map[_keys[_k]]; _div_count = _div_count * (_e + 1); var _seg = 0; for (var _j = 0; _j <= _e; _j++) _seg += Math.pow(_kk, _j); _sum_div = _sum_div * _seg; } _fact_str = _keys.map(function(k){ return _map[k] > 1 ? k + '^' + _map[k]: k; }).join(' x '); _is_prime = (_factors.length === 1 && _factors[0] === _n)

Each output field is produced by substituting the supplied inputs into the relevant relation and then applying the declared rounding or text format.

Worked Examples

Example 1: Highly Composite Number — 360

Inputs

number: 360
Prime or Composite?: false. Number of Divisors: 1. Sum of All Divisors: 1

With Positive Integer = 360 as the stated inputs, the result is Prime or Composite? = false, Number of Divisors = 1 and Sum of All Divisors = 1. Each value corresponds to the declared output fields.

Example 2: Large Prime — 9973

Inputs

number: 9973
Prime or Composite?: false. Number of Divisors: 1. Sum of All Divisors: 1

With Positive Integer = 9,973 as the stated inputs, the result is Prime or Composite? = false, Number of Divisors = 1 and Sum of All Divisors = 1. Each value corresponds to the declared output fields.

Example 3: Perfect Number Check — 28

Inputs

number: 28
Prime or Composite?: false. Number of Divisors: 1. Sum of All Divisors: 1

With Positive Integer = 28 as the stated inputs, the result is Prime or Composite? = false, Number of Divisors = 1 and Sum of All Divisors = 1. Each value corresponds to the declared output fields.

Example 4: Power of 2 — Binary

Inputs

number: 1024
Prime or Composite?: false. Number of Divisors: 1. Sum of All Divisors: 1

With Positive Integer = 1,024 as the stated inputs, the result is Prime or Composite? = false, Number of Divisors = 1 and Sum of All Divisors = 1. Each value corresponds to the declared output fields.

Common Use Cases

  • Find all prime factors of a number
  • Check if a number is prime
  • Calculate number of divisors
  • Find GCD/LCM via prime factorization