I need to Write a procedure (ways-to-factor n m) that computes the number of different ways in which n can be represented as a product of integers, each of them is at least m. A factor may appear more than once in the representation, and the order of the factor doesn’t matter, and n and m are positive integers.
For example:
> (ways-to-factor 4 3)
0
> (ways-to-factor 8 2)
2
> (ways-to-factor 8 8)
0
> (ways-to-factor 1 1)
1
I'm very new at this, so I don't know how to this/
Thanks for any kind of help...
Writing a procedure in Scheme
Started by john galt, Nov 08 2009 09:01 PM
3 replies to this topic
#1
Posted 08 November 2009 - 09:01 PM
|
|
|
#2
Posted 09 November 2009 - 08:32 AM
Well, to start with, can you get the above answers by hand? Can you write down how you're doing them?
#3
Posted 09 November 2009 - 02:45 PM
eh...,sry if i don't understand xP, so my guess here is, you want to say something like
how many different ways can i arrive at the number N, by multiplying unknown numbers where either one of the two unknown numbers has to be m, (or both) ?
edit:
my bad, i was assuming that there would only be 2 unknown numbers to multiply, but 1 of those numbers have to be M ?, in that case, your example of:
(ways-to-factor 8 2)
would be:
1) 4 x m 2) m x m x m (if m = 2)
my guess for solving this would be to see how many times one can divide N by M, and count them up, although haven't gone too deeply into this, as im not even sure if thats wat u want :S
how many different ways can i arrive at the number N, by multiplying unknown numbers where either one of the two unknown numbers has to be m, (or both) ?
edit:
my bad, i was assuming that there would only be 2 unknown numbers to multiply, but 1 of those numbers have to be M ?, in that case, your example of:
(ways-to-factor 8 2)
would be:
1) 4 x m 2) m x m x m (if m = 2)
my guess for solving this would be to see how many times one can divide N by M, and count them up, although haven't gone too deeply into this, as im not even sure if thats wat u want :S
Edited by Soupdude, 09 November 2009 - 02:56 PM.
further suggesting
#4
Posted 09 November 2009 - 05:03 PM
Factorings of 8 are:
2x2x2
2x4
1x8 -> invalid, uses 1<2
Now try 36 3 :)
2x2x2
2x4
1x8 -> invalid, uses 1<2
Now try 36 3 :)


Sign In
Create Account

Back to top









