XtGem Forum catalog


seconds + f p _ x
(More)
Factorization: 
Note:

This program calculates the prime factorization of the given Gaussian integer. A Gaussian integer is a complex number of the form a + bi, where a and b are integers. This program has a limit of | a|, | b| < 226. If the number is large, the program may hang for a few seconds.

The factorization is put into the following canonical form:

  • If the number is 0, 1, −1, i, or −i, then the factorization is the number itself.

  • Otherwise the factorization begins with a factor of −1 or i or −i if necessary. The rest are primes listed in ascending order of absolute value, breaking ties by lowest argument (angle); each of these factors have absolute value > 1 and are in the first quadrant (0 ≤ argument < π/2).

Examples
  • −1 = (−1) (unit)
  • 2 = (−i) (1 + i) (1 + i)
  • 4 + i = (4 + i) (prime)
  • 7 = (7) (prime)
  • 5 + 9i = (1 + i) (7 + 2i)
Input format
  • The real or imaginary component can be suppressed, and they can be in either order. The 1 can be suppressed for i. For example, all these are valid inputs: -0, 5i, 1+2i, -i-2

  • Spaces are allowed anywhere in the Gaussian integer, except within a string of digits.

  • To indicate negative numbers, the ASCII hyphen-minus (U+002D) and the minus sign (U+2212) are both acceptable. (The output properly uses the minus sign, though.)

  • j is an acceptable synonym for i, for those electrical engineers out there.


Translate
Copyright © Arslan100 2020 - 2024

Home | About Us | Frequently Asked Question | Contact Us | Disclaimer | Terms of Services | Request Your File/Code









Online: 1 , Today: 1, Total: 135
Last modified: 01-05-2021