0

EDIT

This question was originally asked in StackOverflow:

We know what it means in code but not in mathematics.

Yet, the following is my attempt to interpret it.

Although this has already been close, I hope someone can share light on it eventually.

Original question

I've got this function, but I can't figure out what does it describes.

The function:

f(n,x,y)

Returns the number for times the product of x times y is exactly n

What I can't figure out/understand is what are the "steps" ( the way n, x and y change )?

Here's a table

n=7 x=2	y=3
7   2	3
5   2	2
4   3	2
3   2	1
3   4	2
2   3	1
2   5	2
1   2	0
1   4	1
1   6	2
0   3	0
0   5	1
0   7	2

This function return 1, because only in n=0, x=3, y=0 the product of x times y is exactly the value of n

for f( n=8, x=2, y=3) the value is 2 ( when

n=0, x=4, y=0 and

n=3, x=3, y=1 )

f( n=9, x=2, y=3) the value is 3 ( when

n=0, x=5, y=0 ,

n=0, x=4, y=0 and

n=6, x=3, y=2 )

What does that function describe?

Here's the function in python

def somerec(n, x, y):
    if n < x*y:
        return 0
    if n == x*y:
        return 1
    sum_ = 0
    for i in range(x, n+1):
        sum_ += somerec(n-i, i, y-1)
    return sum_

And in Java:

public class SomeRec {

    public static void main( String  [] args ) {
        int n = Integer.parseInt(args[0]);
        int x = Integer.parseInt(args[1]);
        int y = Integer.parseInt(args[2]);
        System.out.println( somerec( n,x,y ));
    }

    public static int somerec(  int n, int x, int y ) {
          if (n < x*y){
              return 0;
          } else if (n == x*y) {
            return 1;
          } else {
            int sum = 0;
            for (int i=x; i<=n;i++) {
                sum += somerec(n-i,i,y-1);
            }
            return sum;
          }
    }
}

Thanks for the help in advance, and I apologize for not using mathematical terms :-S

flag
1 
I'm really confused. The recurrence you describe seems to have very little to do with the English you used to describe it. Can you tell us why you want to understand this function? – Qiaochu Yuan Oct 15 2009 at 3:14
Oooops sorry. That was kind of using my own words. Background: I was helping someone to understand programming recursion ( I'm software developer ) so we've got this piece of code. It is easy to understand what it does (in code ) but trying to understand what it does in general, what represents, is a complete mystery to me, it's out of my skills. I'm curious about it. – Oscar Reyes Oct 15 2009 at 3:25
@Oscar: Your description doesn't seem to match the code, and you haven't provided any motivation to explain why you're interested in this function, or why anybody else should be interested in it. It has received a few flags for being off topic, so I'm going to close it. It seems like Math Overflow probably isn't the right place for this question. stackoverflow.com may be a better bet. – Anton Geraschenko Oct 15 2009 at 3:30
Actually I'm coming from that site stackoverflow.com/questions/1569798/… We understand what the function does in "code" but we don't have a clue on mathematics. Yet, it is fair to have this closed since is not a real question ( yes, I agree is off topic ) I would do the same in SO :) :) Best regards, and thanks for the help. I mean... for the attention :) Cheers! – Oscar Reyes Oct 15 2009 at 15:34

closed as off topic by Anton Geraschenko♦♦ Oct 15 2009 at 3:30

Browse other questions tagged or ask your own question.