Given a prime factorization of a number, find all of its other factorizations (not factors)
$begingroup$
Is there an algorithm to determine all distinct factorizations of a number, if both the number and its prime factorization are known?
Example
n = 64
f = 2^6
The factors are:
1, 2, 4, 8, 16, 32, 64
I am not asking for the above. Instead, is there a method to find the following:
- 1 * 64
- 2 * 32
- 2 * 2 * 16
- 2 * 2 * 2 * 8
- 2 * 2 * 2 * 2 * 4
- 2 * 2 * 2 * 2 * 2 * 2
- 4 * 16
- 4 * 2 * 8
- 4 * 4 * 4
- 8 * 8
The above example has one distinct prime factor, but I would like a solution generalized to n distinct prime factors.
combinatorics number-theory
$endgroup$
add a comment |
$begingroup$
Is there an algorithm to determine all distinct factorizations of a number, if both the number and its prime factorization are known?
Example
n = 64
f = 2^6
The factors are:
1, 2, 4, 8, 16, 32, 64
I am not asking for the above. Instead, is there a method to find the following:
- 1 * 64
- 2 * 32
- 2 * 2 * 16
- 2 * 2 * 2 * 8
- 2 * 2 * 2 * 2 * 4
- 2 * 2 * 2 * 2 * 2 * 2
- 4 * 16
- 4 * 2 * 8
- 4 * 4 * 4
- 8 * 8
The above example has one distinct prime factor, but I would like a solution generalized to n distinct prime factors.
combinatorics number-theory
$endgroup$
add a comment |
$begingroup$
Is there an algorithm to determine all distinct factorizations of a number, if both the number and its prime factorization are known?
Example
n = 64
f = 2^6
The factors are:
1, 2, 4, 8, 16, 32, 64
I am not asking for the above. Instead, is there a method to find the following:
- 1 * 64
- 2 * 32
- 2 * 2 * 16
- 2 * 2 * 2 * 8
- 2 * 2 * 2 * 2 * 4
- 2 * 2 * 2 * 2 * 2 * 2
- 4 * 16
- 4 * 2 * 8
- 4 * 4 * 4
- 8 * 8
The above example has one distinct prime factor, but I would like a solution generalized to n distinct prime factors.
combinatorics number-theory
$endgroup$
Is there an algorithm to determine all distinct factorizations of a number, if both the number and its prime factorization are known?
Example
n = 64
f = 2^6
The factors are:
1, 2, 4, 8, 16, 32, 64
I am not asking for the above. Instead, is there a method to find the following:
- 1 * 64
- 2 * 32
- 2 * 2 * 16
- 2 * 2 * 2 * 8
- 2 * 2 * 2 * 2 * 4
- 2 * 2 * 2 * 2 * 2 * 2
- 4 * 16
- 4 * 2 * 8
- 4 * 4 * 4
- 8 * 8
The above example has one distinct prime factor, but I would like a solution generalized to n distinct prime factors.
combinatorics number-theory
combinatorics number-theory
asked Dec 14 '18 at 18:13
K PekoshK Pekosh
62
62
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
$begingroup$
Recursively: for each factor $f$ of your number $n$, prepend $(f)$ to all factorizations of $n/f$ where all factors $ge f$...
$endgroup$
add a comment |
$begingroup$
As pointed out by @Adrian Keister in a comment, what follows doesn't answer the question asked. However, because this answers what is probably an often asked related question, I'll leave it up, at least unless I start getting killed with downvotes $ldots$
Let $N$ be a positive integer with prime factorization
$$ N ; = ; p_{1}^{n_1} p_{2}^{n_2} p_{3}^{n_3} cdots p_{k}^{n_k}$$
Then, including $1$ and $N,$ there are
$$ (n_1 + 1)(n_2 + 1)(n_3 + 1) cdots (n_k + 1) $$
many factors of $N,$ and each factor has the form
$$ p_{1}^{{alpha}_1} p_{2}^{{alpha}_2} p_{3}^{{alpha}_3} cdots p_{k}^{{alpha}_k}$$
where each $alpha_i$ belongs to ${0,,1,,2,,3,, ldots,,n_i }.$
Example: Let $N = 45000 = 2^3 cdot 3^2 cdot 5^4.$ Then the $(3+1)(2+1)(4+1) = 60$ many factors are
$$ 2^0 cdot 3^0 cdot 5^0 ;;;;;;; 2^0 cdot 3^0 cdot 5^1 ;;;;;;; 2^0 cdot 3^0 cdot 5^2 ;;;;;;; 2^0 cdot 3^0 cdot 5^3 ;;;;;;; 2^0 cdot 3^0 cdot 5^4 $$
$$ 2^0 cdot 3^1 cdot 5^0 ;;;;;;; 2^0 cdot 3^1 cdot 5^1 ;;;;;;; 2^0 cdot 3^1 cdot 5^2 ;;;;;;; 2^0 cdot 3^1 cdot 5^3 ;;;;;;; 2^0 cdot 3^1 cdot 5^4 $$
$$ 2^0 cdot 3^2 cdot 5^0 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ot 5^1 ;;;;;;; 2^3 cdot 3^0 cdot 5^2 ;;;;;;; 2^3 cdot 3^0 cdot 5^3 ;;;;;;; 2^3 cdot 3^0 cdot 5^4 $$
$$ 2^3 cdot 3^1 cdot 5^0 ;;;;;;; 2^3 cdot 3^1 cdot 5^1 ;;;;;;; 2^3 cdot 3^1 cdot 5^2 ;;;;;;; 2^3 cdot 3^1 cdot 5^3 ;;;;;;; 2^3 cdot 3^1 cdot 5^4 $$
$$ 2^3 cdot 3^2 cdot 5^0 ;;;;;;; 2^3 cdot 3^2 cdot 5^1 ;;;;;;; 2^3 cdot 3^2 cdot 5^2 ;;;;;;; 2^3 cdot 3^2 cdot 5^3 ;;;;;;; 2^3 cdot 3^2 cdot 5^4 $$
In this example, note that the exponents on $2$ come from ${0,,1,,2,,3}$ and the exponents on $3$ come from ${0,,1,,2}$ and the exponents on $5$ come from ${0,,1,,2,,3,, 4}.$ One way to organize the possible choices of choosing exponents is the same way you would when trying all combinations for a combination lock whose unlocking sequence of digits you've forgotten or lost, sometime I've had to do at least twice, and not for fun, when I was a child.
$endgroup$
$begingroup$
This will find all the factors. But the OP wants all the factorizations of the full number. The tricky part, it seems to me, is that you have a varying number of numbers in all possible factorizations. It's kind of like a partition of the prime factorization: how many ways can you "clump" the numbers in the prime factorization into different numbers?
$endgroup$
– Adrian Keister
Dec 14 '18 at 18:56
$begingroup$
@Adrian Keister: I just reread the question more carefully, and I see your point. I'll add a disclaimer, but after all that formatting I'm not really up to trying to do what appears to be asked.
$endgroup$
– Dave L. Renfro
Dec 14 '18 at 19:04
$begingroup$
Yes @AdrianKeister, exactly. I am familiar with Dave's answer; I have notes from this lecture in college. This does give me the idea of considering how to split and permute the exponents to which each prime is raised to generate all factorizations.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:05
$begingroup$
@DaveLRenfro: I think you could adapt your answer. I found a C++ answer on SO, but it was recursive, and didn't seem to take advantage of knowing the prime factorization.
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:06
$begingroup$
Maybe adapt a partition-finding algorithm?
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:09
|
show 4 more comments
$begingroup$
You can iterate through all divisors $d$ of $n$ and then recursively list all factorizations of $n/d$ where every factor is at most $d$. If you want to know how to implement this efficiently, I can code something in c++.
$endgroup$
$begingroup$
That would be cool. I am looking to implement it in Go, but C++ (or pseudocode) would be good too.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:03
$begingroup$
Try this SO question: stackoverflow.com/questions/31932357/…
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:15
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3039731%2fgiven-a-prime-factorization-of-a-number-find-all-of-its-other-factorizations-n%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Recursively: for each factor $f$ of your number $n$, prepend $(f)$ to all factorizations of $n/f$ where all factors $ge f$...
$endgroup$
add a comment |
$begingroup$
Recursively: for each factor $f$ of your number $n$, prepend $(f)$ to all factorizations of $n/f$ where all factors $ge f$...
$endgroup$
add a comment |
$begingroup$
Recursively: for each factor $f$ of your number $n$, prepend $(f)$ to all factorizations of $n/f$ where all factors $ge f$...
$endgroup$
Recursively: for each factor $f$ of your number $n$, prepend $(f)$ to all factorizations of $n/f$ where all factors $ge f$...
answered Dec 14 '18 at 18:24
Robert IsraelRobert Israel
322k23212465
322k23212465
add a comment |
add a comment |
$begingroup$
As pointed out by @Adrian Keister in a comment, what follows doesn't answer the question asked. However, because this answers what is probably an often asked related question, I'll leave it up, at least unless I start getting killed with downvotes $ldots$
Let $N$ be a positive integer with prime factorization
$$ N ; = ; p_{1}^{n_1} p_{2}^{n_2} p_{3}^{n_3} cdots p_{k}^{n_k}$$
Then, including $1$ and $N,$ there are
$$ (n_1 + 1)(n_2 + 1)(n_3 + 1) cdots (n_k + 1) $$
many factors of $N,$ and each factor has the form
$$ p_{1}^{{alpha}_1} p_{2}^{{alpha}_2} p_{3}^{{alpha}_3} cdots p_{k}^{{alpha}_k}$$
where each $alpha_i$ belongs to ${0,,1,,2,,3,, ldots,,n_i }.$
Example: Let $N = 45000 = 2^3 cdot 3^2 cdot 5^4.$ Then the $(3+1)(2+1)(4+1) = 60$ many factors are
$$ 2^0 cdot 3^0 cdot 5^0 ;;;;;;; 2^0 cdot 3^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cdot 3^1 cdot 5^2 ;;;;;;; 2^2 cdot 3^1 cdot 5^3 ;;;;;;; 2^2 cdot 3^1 cdot 5^4 $$
$$ 2^2 cdot 3^2 cdot 5^0 ;;;;;;; 2^2 cdot 3^2 cdot 5^1 ;;;;;;; 2^2 cdot 3^2 cdot 5^2 ;;;;;;; 2^2 cdot 3^2 cdot 5^3 ;;;;;;; 2^2 cdot 3^2 cdot 5^4 $$
$$ 2^3 cdot 3^0 cdot 5^0 ;;;;;;; 2^3 cdot 3^0 cdot 5^1 ;;;;;;; 2^3 cdot 3^0 cdot 5^2 ;;;;;;; 2^3 cdot 3^0 cdot 5^3 ;;;;;;; 2^3 cdot 3^0 cdot 5^4 $$
$$ 2^3 cdot 3^1 cdot 5^0 ;;;;;;; 2^3 cdot 3^1 cdot 5^1 ;;;;;;; 2^3 cdot 3^1 cdot 5^2 ;;;;;;; 2^3 cdot 3^1 cdot 5^3 ;;;;;;; 2^3 cdot 3^1 cdot 5^4 $$
$$ 2^3 cdot 3^2 cdot 5^0 ;;;;;;; 2^3 cdot 3^2 cdot 5^1 ;;;;;;; 2^3 cdot 3^2 cdot 5^2 ;;;;;;; 2^3 cdot 3^2 cdot 5^3 ;;;;;;; 2^3 cdot 3^2 cdot 5^4 $$
In this example, note that the exponents on $2$ come from ${0,,1,,2,,3}$ and the exponents on $3$ come from ${0,,1,,2}$ and the exponents on $5$ come from ${0,,1,,2,,3,, 4}.$ One way to organize the possible choices of choosing exponents is the same way you would when trying all combinations for a combination lock whose unlocking sequence of digits you've forgotten or lost, sometime I've had to do at least twice, and not for fun, when I was a child.
$endgroup$
$begingroup$
This will find all the factors. But the OP wants all the factorizations of the full number. The tricky part, it seems to me, is that you have a varying number of numbers in all possible factorizations. It's kind of like a partition of the prime factorization: how many ways can you "clump" the numbers in the prime factorization into different numbers?
$endgroup$
– Adrian Keister
Dec 14 '18 at 18:56
$begingroup$
@Adrian Keister: I just reread the question more carefully, and I see your point. I'll add a disclaimer, but after all that formatting I'm not really up to trying to do what appears to be asked.
$endgroup$
– Dave L. Renfro
Dec 14 '18 at 19:04
$begingroup$
Yes @AdrianKeister, exactly. I am familiar with Dave's answer; I have notes from this lecture in college. This does give me the idea of considering how to split and permute the exponents to which each prime is raised to generate all factorizations.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:05
$begingroup$
@DaveLRenfro: I think you could adapt your answer. I found a C++ answer on SO, but it was recursive, and didn't seem to take advantage of knowing the prime factorization.
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:06
$begingroup$
Maybe adapt a partition-finding algorithm?
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:09
|
show 4 more comments
$begingroup$
As pointed out by @Adrian Keister in a comment, what follows doesn't answer the question asked. However, because this answers what is probably an often asked related question, I'll leave it up, at least unless I start getting killed with downvotes $ldots$
Let $N$ be a positive integer with prime factorization
$$ N ; = ; p_{1}^{n_1} p_{2}^{n_2} p_{3}^{n_3} cdots p_{k}^{n_k}$$
Then, including $1$ and $N,$ there are
$$ (n_1 + 1)(n_2 + 1)(n_3 + 1) cdots (n_k + 1) $$
many factors of $N,$ and each factor has the form
$$ p_{1}^{{alpha}_1} p_{2}^{{alpha}_2} p_{3}^{{alpha}_3} cdots p_{k}^{{alpha}_k}$$
where each $alpha_i$ belongs to ${0,,1,,2,,3,, ldots,,n_i }.$
Example: Let $N = 45000 = 2^3 cdot 3^2 cdot 5^4.$ Then the $(3+1)(2+1)(4+1) = 60$ many factors are
$$ 2^0 cdot 3^0 cdot 5^0 ;;;;;;; 2^0 cdot 3^0 cdot 5^1 ;;;;;;; 2^0 cdot 3^0 cdot 5^2 ;;;;;;; 2^0 cdot 3^0 cdot 5^3 ;;;;;;; 2^0 cdot 3^0 cdot 5^4 $$
$$ 2^0 cdot 3^1 cdot 5^0 ;;;;;;; 2^0 cdot 3^1 cdot 5^1 ;;;;;;; 2^0 cdot 3^1 cdot 5^2 ;;;;;;; 2^0 cdot 3^1 cdot 5^3 ;;;;;;; 2^0 cdot 3^1 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3^0 cdot 5^0 ;;;;;;; 2^3 cdot 3^0 cdot 5^1 ;;;;;;; 2^3 cdot 3^0 cdot 5^2 ;;;;;;; 2^3 cdot 3^0 cdot 5^3 ;;;;;;; 2^3 cdot 3^0 cdot 5^4 $$
$$ 2^3 cdot 3^1 cdot 5^0 ;;;;;;; 2^3 cdot 3^1 cdot 5^1 ;;;;;;; 2^3 cdot 3^1 cdot 5^2 ;;;;;;; 2^3 cdot 3^1 cdot 5^3 ;;;;;;; 2^3 cdot 3^1 cdot 5^4 $$
$$ 2^3 cdot 3^2 cdot 5^0 ;;;;;;; 2^3 cdot 3^2 cdot 5^1 ;;;;;;; 2^3 cdot 3^2 cdot 5^2 ;;;;;;; 2^3 cdot 3^2 cdot 5^3 ;;;;;;; 2^3 cdot 3^2 cdot 5^4 $$
In this example, note that the exponents on $2$ come from ${0,,1,,2,,3}$ and the exponents on $3$ come from ${0,,1,,2}$ and the exponents on $5$ come from ${0,,1,,2,,3,, 4}.$ One way to organize the possible choices of choosing exponents is the same way you would when trying all combinations for a combination lock whose unlocking sequence of digits you've forgotten or lost, sometime I've had to do at least twice, and not for fun, when I was a child.
$endgroup$
$begingroup$
This will find all the factors. But the OP wants all the factorizations of the full number. The tricky part, it seems to me, is that you have a varying number of numbers in all possible factorizations. It's kind of like a partition of the prime factorization: how many ways can you "clump" the numbers in the prime factorization into different numbers?
$endgroup$
– Adrian Keister
Dec 14 '18 at 18:56
$begingroup$
@Adrian Keister: I just reread the question more carefully, and I see your point. I'll add a disclaimer, but after all that formatting I'm not really up to trying to do what appears to be asked.
$endgroup$
– Dave L. Renfro
Dec 14 '18 at 19:04
$begingroup$
Yes @AdrianKeister, exactly. I am familiar with Dave's answer; I have notes from this lecture in college. This does give me the idea of considering how to split and permute the exponents to which each prime is raised to generate all factorizations.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:05
$begingroup$
@DaveLRenfro: I think you could adapt your answer. I found a C++ answer on SO, but it was recursive, and didn't seem to take advantage of knowing the prime factorization.
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:06
$begingroup$
Maybe adapt a partition-finding algorithm?
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:09
|
show 4 more comments
$begingroup$
As pointed out by @Adrian Keister in a comment, what follows doesn't answer the question asked. However, because this answers what is probably an often asked related question, I'll leave it up, at least unless I start getting killed with downvotes $ldots$
Let $N$ be a positive integer with prime factorization
$$ N ; = ; p_{1}^{n_1} p_{2}^{n_2} p_{3}^{n_3} cdots p_{k}^{n_k}$$
Then, including $1$ and $N,$ there are
$$ (n_1 + 1)(n_2 + 1)(n_3 + 1) cdots (n_k + 1) $$
many factors of $N,$ and each factor has the form
$$ p_{1}^{{alpha}_1} p_{2}^{{alpha}_2} p_{3}^{{alpha}_3} cdots p_{k}^{{alpha}_k}$$
where each $alpha_i$ belongs to ${0,,1,,2,,3,, ldots,,n_i }.$
Example: Let $N = 45000 = 2^3 cdot 3^2 cdot 5^4.$ Then the $(3+1)(2+1)(4+1) = 60$ many factors are
$$ 2^0 cdot 3^0 cdot 5^0 ;;;;;;; 2^0 cdot 3^0 cdot 5^1 ;;;;;;; 2^0 cdot 3^0 cdot 5^2 ;;;;;;; 2^0 cdot 3^0 cdot 5^3 ;;;;;;; 2^0 cdot 3^0 cdot 5^4 $$
$$ 2^0 cdot 3^1 cdot 5^0 ;;;;;;; 2^0 cdot 3^1 cdot 5^1 ;;;;;;; 2^0 cdot 3^1 cdot 5^2 ;;;;;;; 2^0 cdot 3^1 cdot 5^3 ;;;;;;; 2^0 cdot 3^1 cdot 5^4 $$
$$ 2^0 cdot 3^2 cdot 5^0 ;;;;;;; 2^0 cdot 3^2 cdot 5^1 ;;;;;;; 2^0 cdot 3^2 cdot 5^2 ;;;;;;; 2^0 cdot 3^2 cdot 5^3 ;;;;;;; 2^0 cdot 3^2 cdot 5^4 $$
$$ 2^1 cdot 3^0 cdot 5^0 ;;;;;;; 2^1 cdot 3^0 cdot 5^1 ;;;;;;; 2^1 cdot 3^0 cdot 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1 cdot 5^3 ;;;;;;; 2^3 cdot 3^1 cdot 5^4 $$
$$ 2^3 cdot 3^2 cdot 5^0 ;;;;;;; 2^3 cdot 3^2 cdot 5^1 ;;;;;;; 2^3 cdot 3^2 cdot 5^2 ;;;;;;; 2^3 cdot 3^2 cdot 5^3 ;;;;;;; 2^3 cdot 3^2 cdot 5^4 $$
In this example, note that the exponents on $2$ come from ${0,,1,,2,,3}$ and the exponents on $3$ come from ${0,,1,,2}$ and the exponents on $5$ come from ${0,,1,,2,,3,, 4}.$ One way to organize the possible choices of choosing exponents is the same way you would when trying all combinations for a combination lock whose unlocking sequence of digits you've forgotten or lost, sometime I've had to do at least twice, and not for fun, when I was a child.
$endgroup$
As pointed out by @Adrian Keister in a comment, what follows doesn't answer the question asked. However, because this answers what is probably an often asked related question, I'll leave it up, at least unless I start getting killed with downvotes $ldots$
Let $N$ be a positive integer with prime factorization
$$ N ; = ; p_{1}^{n_1} p_{2}^{n_2} p_{3}^{n_3} cdots p_{k}^{n_k}$$
Then, including $1$ and $N,$ there are
$$ (n_1 + 1)(n_2 + 1)(n_3 + 1) cdots (n_k + 1) $$
many factors of $N,$ and each factor has the form
$$ p_{1}^{{alpha}_1} p_{2}^{{alpha}_2} p_{3}^{{alpha}_3} cdots p_{k}^{{alpha}_k}$$
where each $alpha_i$ belongs to ${0,,1,,2,,3,, ldots,,n_i }.$
Example: Let $N = 45000 = 2^3 cdot 3^2 cdot 5^4.$ Then the $(3+1)(2+1)(4+1) = 60$ many factors are
$$ 2^0 cdot 3^0 cdot 5^0 ;;;;;;; 2^0 cdot 3^0 cdot 5^1 ;;;;;;; 2^0 cdot 3^0 cdot 5^2 ;;;;;;; 2^0 cdot 3^0 cdot 5^3 ;;;;;;; 2^0 cdot 3^0 cdot 5^4 $$
$$ 2^0 cdot 3^1 cdot 5^0 ;;;;;;; 2^0 cdot 3^1 cdot 5^1 ;;;;;;; 2^0 cdot 3^1 cdot 5^2 ;;;;;;; 2^0 cdot 3^1 cdot 5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 cdot 5^4 $$
$$ 2^3 cdot 3^0 cdot 5^0 ;;;;;;; 2^3 cdot 3^0 cdot 5^1 ;;;;;;; 2^3 cdot 3^0 cdot 5^2 ;;;;;;; 2^3 cdot 3^0 cdot 5^3 ;;;;;;; 2^3 cdot 3^0 cdot 5^4 $$
$$ 2^3 cdot 3^1 cdot 5^0 ;;;;;;; 2^3 cdot 3^1 cdot 5^1 ;;;;;;; 2^3 cdot 3^1 cdot 5^2 ;;;;;;; 2^3 cdot 3^1 cdot 5^3 ;;;;;;; 2^3 cdot 3^1 cdot 5^4 $$
$$ 2^3 cdot 3^2 cdot 5^0 ;;;;;;; 2^3 cdot 3^2 cdot 5^1 ;;;;;;; 2^3 cdot 3^2 cdot 5^2 ;;;;;;; 2^3 cdot 3^2 cdot 5^3 ;;;;;;; 2^3 cdot 3^2 cdot 5^4 $$
In this example, note that the exponents on $2$ come from ${0,,1,,2,,3}$ and the exponents on $3$ come from ${0,,1,,2}$ and the exponents on $5$ come from ${0,,1,,2,,3,, 4}.$ One way to organize the possible choices of choosing exponents is the same way you would when trying all combinations for a combination lock whose unlocking sequence of digits you've forgotten or lost, sometime I've had to do at least twice, and not for fun, when I was a child.
edited Dec 14 '18 at 19:07
answered Dec 14 '18 at 18:51
Dave L. RenfroDave L. Renfro
24.7k33981
24.7k33981
$begingroup$
This will find all the factors. But the OP wants all the factorizations of the full number. The tricky part, it seems to me, is that you have a varying number of numbers in all possible factorizations. It's kind of like a partition of the prime factorization: how many ways can you "clump" the numbers in the prime factorization into different numbers?
$endgroup$
– Adrian Keister
Dec 14 '18 at 18:56
$begingroup$
@Adrian Keister: I just reread the question more carefully, and I see your point. I'll add a disclaimer, but after all that formatting I'm not really up to trying to do what appears to be asked.
$endgroup$
– Dave L. Renfro
Dec 14 '18 at 19:04
$begingroup$
Yes @AdrianKeister, exactly. I am familiar with Dave's answer; I have notes from this lecture in college. This does give me the idea of considering how to split and permute the exponents to which each prime is raised to generate all factorizations.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:05
$begingroup$
@DaveLRenfro: I think you could adapt your answer. I found a C++ answer on SO, but it was recursive, and didn't seem to take advantage of knowing the prime factorization.
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:06
$begingroup$
Maybe adapt a partition-finding algorithm?
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:09
|
show 4 more comments
$begingroup$
This will find all the factors. But the OP wants all the factorizations of the full number. The tricky part, it seems to me, is that you have a varying number of numbers in all possible factorizations. It's kind of like a partition of the prime factorization: how many ways can you "clump" the numbers in the prime factorization into different numbers?
$endgroup$
– Adrian Keister
Dec 14 '18 at 18:56
$begingroup$
@Adrian Keister: I just reread the question more carefully, and I see your point. I'll add a disclaimer, but after all that formatting I'm not really up to trying to do what appears to be asked.
$endgroup$
– Dave L. Renfro
Dec 14 '18 at 19:04
$begingroup$
Yes @AdrianKeister, exactly. I am familiar with Dave's answer; I have notes from this lecture in college. This does give me the idea of considering how to split and permute the exponents to which each prime is raised to generate all factorizations.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:05
$begingroup$
@DaveLRenfro: I think you could adapt your answer. I found a C++ answer on SO, but it was recursive, and didn't seem to take advantage of knowing the prime factorization.
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:06
$begingroup$
Maybe adapt a partition-finding algorithm?
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:09
$begingroup$
This will find all the factors. But the OP wants all the factorizations of the full number. The tricky part, it seems to me, is that you have a varying number of numbers in all possible factorizations. It's kind of like a partition of the prime factorization: how many ways can you "clump" the numbers in the prime factorization into different numbers?
$endgroup$
– Adrian Keister
Dec 14 '18 at 18:56
$begingroup$
This will find all the factors. But the OP wants all the factorizations of the full number. The tricky part, it seems to me, is that you have a varying number of numbers in all possible factorizations. It's kind of like a partition of the prime factorization: how many ways can you "clump" the numbers in the prime factorization into different numbers?
$endgroup$
– Adrian Keister
Dec 14 '18 at 18:56
$begingroup$
@Adrian Keister: I just reread the question more carefully, and I see your point. I'll add a disclaimer, but after all that formatting I'm not really up to trying to do what appears to be asked.
$endgroup$
– Dave L. Renfro
Dec 14 '18 at 19:04
$begingroup$
@Adrian Keister: I just reread the question more carefully, and I see your point. I'll add a disclaimer, but after all that formatting I'm not really up to trying to do what appears to be asked.
$endgroup$
– Dave L. Renfro
Dec 14 '18 at 19:04
$begingroup$
Yes @AdrianKeister, exactly. I am familiar with Dave's answer; I have notes from this lecture in college. This does give me the idea of considering how to split and permute the exponents to which each prime is raised to generate all factorizations.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:05
$begingroup$
Yes @AdrianKeister, exactly. I am familiar with Dave's answer; I have notes from this lecture in college. This does give me the idea of considering how to split and permute the exponents to which each prime is raised to generate all factorizations.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:05
$begingroup$
@DaveLRenfro: I think you could adapt your answer. I found a C++ answer on SO, but it was recursive, and didn't seem to take advantage of knowing the prime factorization.
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:06
$begingroup$
@DaveLRenfro: I think you could adapt your answer. I found a C++ answer on SO, but it was recursive, and didn't seem to take advantage of knowing the prime factorization.
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:06
$begingroup$
Maybe adapt a partition-finding algorithm?
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:09
$begingroup$
Maybe adapt a partition-finding algorithm?
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:09
|
show 4 more comments
$begingroup$
You can iterate through all divisors $d$ of $n$ and then recursively list all factorizations of $n/d$ where every factor is at most $d$. If you want to know how to implement this efficiently, I can code something in c++.
$endgroup$
$begingroup$
That would be cool. I am looking to implement it in Go, but C++ (or pseudocode) would be good too.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:03
$begingroup$
Try this SO question: stackoverflow.com/questions/31932357/…
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:15
add a comment |
$begingroup$
You can iterate through all divisors $d$ of $n$ and then recursively list all factorizations of $n/d$ where every factor is at most $d$. If you want to know how to implement this efficiently, I can code something in c++.
$endgroup$
$begingroup$
That would be cool. I am looking to implement it in Go, but C++ (or pseudocode) would be good too.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:03
$begingroup$
Try this SO question: stackoverflow.com/questions/31932357/…
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:15
add a comment |
$begingroup$
You can iterate through all divisors $d$ of $n$ and then recursively list all factorizations of $n/d$ where every factor is at most $d$. If you want to know how to implement this efficiently, I can code something in c++.
$endgroup$
You can iterate through all divisors $d$ of $n$ and then recursively list all factorizations of $n/d$ where every factor is at most $d$. If you want to know how to implement this efficiently, I can code something in c++.
answered Dec 14 '18 at 18:23
SmileyCraftSmileyCraft
3,591517
3,591517
$begingroup$
That would be cool. I am looking to implement it in Go, but C++ (or pseudocode) would be good too.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:03
$begingroup$
Try this SO question: stackoverflow.com/questions/31932357/…
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:15
add a comment |
$begingroup$
That would be cool. I am looking to implement it in Go, but C++ (or pseudocode) would be good too.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:03
$begingroup$
Try this SO question: stackoverflow.com/questions/31932357/…
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:15
$begingroup$
That would be cool. I am looking to implement it in Go, but C++ (or pseudocode) would be good too.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:03
$begingroup$
That would be cool. I am looking to implement it in Go, but C++ (or pseudocode) would be good too.
$endgroup$
– K Pekosh
Dec 14 '18 at 19:03
$begingroup$
Try this SO question: stackoverflow.com/questions/31932357/…
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:15
$begingroup$
Try this SO question: stackoverflow.com/questions/31932357/…
$endgroup$
– Adrian Keister
Dec 14 '18 at 19:15
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3039731%2fgiven-a-prime-factorization-of-a-number-find-all-of-its-other-factorizations-n%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown