{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"prime-factorization"},"result":{"entity_type":"calculator","id":"prime-factorization","calculator_id":"prime-factorization","canonical_url":"https://tttkmbb.com/math/prime-factorization","name":"Prime Factorization Calculator","title":"Prime Factorization Calculator – Prime Factors, Primality Test and Number of Divisors","category":"math","category_name":"Math","tool_name":"calculate_prime_factorization","featured_mcp_tool":false,"description":"Decomposes an integer into its prime factors by trial division, tests primality, and derives the number and sum of its divisors from the exponents.","use_when":"You need the prime factors of an integer up to 10^12, want to know whether it is prime, or need its divisor count.","do_not_use_when":"You need the GCD or LCM of several numbers (use gcd-lcm) or factorials and binomial coefficients (use factorial, combinations-permutations).","inputs":[{"name":"n","label":"Integer","type":"integer","required":true,"min":2,"max":1000000000000,"description":"Integer to factor, from 2 to 1,000,000,000,000.","example":360}],"outputs":[{"name":"is_prime","label":"Is prime","type":"boolean","decimals":4,"description":"true when n has no divisors other than 1 and itself."},{"name":"factors","label":"Prime factors","type":"number_list","decimals":0,"description":"Prime factors in ascending order with repetition, e.g. [2, 2, 2, 3, 3, 5]."},{"name":"factorization","label":"Factorization","type":"string","decimals":4,"description":"Prime-power form, e.g. '2^3 × 3^2 × 5'."},{"name":"distinct_primes","label":"Distinct primes","type":"number_list","decimals":0,"description":"Each prime factor once."},{"name":"divisor_count","label":"Number of divisors","type":"integer","decimals":0,"description":"τ(n) = Π (kᵢ + 1) over the exponents kᵢ of the factorization."},{"name":"sum_of_divisors","label":"Sum of divisors","type":"integer","decimals":0,"description":"σ(n) = Π (1 + pᵢ + pᵢ² + … + pᵢ^kᵢ), including 1 and n."}],"input_schema":{"type":"object","properties":{"n":{"description":"Integer to factor, from 2 to 1,000,000,000,000.","type":"integer","minimum":2,"maximum":1000000000000,"examples":[360]}},"additionalProperties":false,"required":["n"]},"output_schema":{"type":"object","properties":{"is_prime":{"description":"true when n has no divisors other than 1 and itself.","type":"boolean"},"factors":{"description":"Prime factors in ascending order with repetition, e.g. [2, 2, 2, 3, 3, 5].","type":"array","items":{"type":"number"}},"factorization":{"description":"Prime-power form, e.g. '2^3 × 3^2 × 5'.","type":"string"},"distinct_primes":{"description":"Each prime factor once.","type":"array","items":{"type":"number"}},"divisor_count":{"description":"τ(n) = Π (kᵢ + 1) over the exponents kᵢ of the factorization.","type":"integer"},"sum_of_divisors":{"description":"σ(n) = Π (1 + pᵢ + pᵢ² + … + pᵢ^kᵢ), including 1 and n.","type":"integer"}}},"formula":"n = p₁^k₁ × p₂^k₂ × … (trial division by 2, then odd numbers up to √n); τ(n) = Π (kᵢ + 1); σ(n) = Π (pᵢ^(kᵢ+1) − 1) / (pᵢ − 1)","sources":[{"name":"Wikipedia – Integer factorization","url":"https://en.wikipedia.org/wiki/Integer_factorization","type":"reference","retrieved_at":"2026-09-23"},{"name":"Wikipedia – Divisor function","url":"https://en.wikipedia.org/wiki/Divisor_function","type":"reference","retrieved_at":"2026-09-23"},{"name":"Wolfram MathWorld – Prime Factorization","url":"https://mathworld.wolfram.com/PrimeFactorization.html","type":"reference","retrieved_at":"2026-09-23"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"360","inputs":{"n":360},"expected":{"is_prime":false,"factors":[2,2,2,3,3,5],"factorization":"2^3 × 3^2 × 5","distinct_primes":[2,3,5],"divisor_count":24,"sum_of_divisors":1170},"url":"https://tttkmbb.com/api/v1/calculate/prime-factorization?n=360"},{"name":"97","inputs":{"n":97},"expected":{"is_prime":true,"factors":[97],"factorization":"97","divisor_count":2,"sum_of_divisors":98},"url":"https://tttkmbb.com/api/v1/calculate/prime-factorization?n=97"}],"faq":[{"q":"Why is 1 not accepted?","a":"1 is neither prime nor composite and has an empty factorization, so the input must be at least 2."},{"q":"How fast is this for large numbers?","a":"Trial division needs at most about 500,000 divisions for n near 10^12, which takes a few milliseconds; larger inputs are rejected."}],"tags":["prime factorization","prime factors","is prime","number of divisors","factor a number"],"related":[{"calculator_id":"gcd-lcm","reason":"Common factors and multiples of several integers."},{"calculator_id":"modulo","reason":"Remainders used in divisibility tests."},{"calculator_id":"factorial","reason":"Products of consecutive integers."}],"links":{"html":"https://tttkmbb.com/math/prime-factorization","markdown":"https://tttkmbb.com/math/prime-factorization.md","json":"https://tttkmbb.com/math/prime-factorization.json","api":"https://tttkmbb.com/api/v1/calculate/prime-factorization","schema":"https://tttkmbb.com/api/v1/calculators/prime-factorization","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-23"},"timestamp":"2026-09-23T23:23:04Z"}