Priotizaer: Prime Factorization-er
How to Use
- Type the input (positive integer) then hit 🏃♂️➡️ Run button or press Enter/Return on keyboard.
- Minimum input value is
1
, and maximum of9,007,199,254,740,991
. - Modify the input value to clear the result.
- To
abort
a certain computation, simply modify the input, delete a number or add another number.
Output
- Priotizaer will show the prime factorisation and factor multiplication list of the input number (if the input can be factorised).
- If the input is a prime number, Priotizaer will return the Prime word.
- For non-integer or negative number or value beyond limit, Priotizaer will show
error
message. - Priotizaer will also show the time spent for the process to finish (in milliseconds) at the bottom of the output.
- We can copy the prime factorisation or a factor multiplication row by clicking/tapping it.
The Limit
-
Because of the iterative ♻️ technique.
This actually has already been solved 🥳
Priotizaer is updated to:- Implement the
Web Worker API
. - Run on the latest cleaned flow and logic.
Therefore, it should go smoother than its initial version ✅
- Implement the
-
JavaScript limitation
Number.MAX_SAFE_INTEGER = 9,007,199,254,740,991
(64‐bit IEEE 754 standard).9,007,199,254,740,991
is nine quadrillion seven trillion one hundred and ninety-nine billion two hundred and fifty-four million seven hundred and forty thousand nine hundred and ninety-one, thank you.
Use Priotizaer as Your Reference
Priotizaer can directly calculate the number using URL parameter. ?number=YOUR_NUMBER
As such:
https://portraptor.johanpaul.net/2015/09/priotizaer-prime-factorization-er.html?number=20
Example, in anchor
tag:
<a
href="https://portraptor.johanpaul.net/2015/09/priotizaer-prime-factorization-er.html?number=20"
target="_blank"
rel="noopener"
title="Open new tab">
Prime factorisation of 20
</a>
The URL template is like so:
https://portraptor.johanpaul.net/2015/09/priotizaer-prime-factorization-er.html?number=YOUR_NUMBER
Template in anchor
tag:
<a
href="https://portraptor.johanpaul.net/2015/09/priotizaer-prime-factorization-er.html?number=YOUR_NUMBER"
target="_blank"
rel="noopener"
title="Open new tab">
YOUR LINK TEXT
</a>
We can serve it as a link for the calculation of a particular number. 👍
Mind you, this is not an API. It's simply using (linking) this actual page — but with number as the query parameter. This post URL doesn't serve calculation through fetch
— you'll certainly get a CORS error. 😂 Because, indeed, it's not meant for that.
✅ Checkmark UNICODE Regular Expression on Blogger
This part is quite a quirk on Blogger. I suppose it's from CodeMirror normalisation method (for rendering consistency). Blogger uses CodeMirror for their text editor.
Thus, here is a snippet to properly match this character ✅ on Blogger:
// - "✅" (U+2705)
// - "☑" (U+2611)
// - "✓" (U+2713)
// - "✔" (U+2714)
// - plus an optional variation selector (U+FE0F)
/(?:\u2705|\u2611|\u2713|\u2714)\uFE0F?/
We can use the u
(unicode) flag for that, optionally:
/(?:\u2705|\u2611|\u2713|\u2714)\uFE0F?/u
GCF and LCM
To find out about finding Greatest Common Factor (GCF) and Least Common Multiple (LCM) using continuous division technique, please try this post on Monkey Raptor — I also provide a JavaScript snippet for the process in the post.