+ Reply to Thread
Results 1 to 4 of 4

Cant count integer partitions by recursive function.

  1. #1
    Registered User
    Join Date
    06-07-2018
    Location
    LA
    MS-Off Ver
    2016
    Posts
    15

    Cant count integer partitions by recursive function.

    Hi guys I want to calculate the number of integer partitions. So that I use this code
    Please Login or Register  to view this content.
    But I get the error as " Run time error 28 Out of stuck space".
    What's wrong with my code?
    Regards,
    Alex
    Last edited by Alex009988; 07-20-2019 at 06:50 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Recursive function dosent work

    Administrative Note:

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,825

    Re: Cant count integer partitions by recursive function.

    I don't have Excel handy to test with, but my guess is that you are getting a lot of recursive calls to the function from within the function with no control over that recursion. Eventually you run out of stack space. The recursion is caused by using p as both your function name and an array variable within the function. It appears to me that the recursion is not intended or essential to the procedure, so I would write it to avoid the unintentional recursion, by changing either the name of the function or the name of the array variable. Since p is not very descriptive of the function's purpose, I would probably change the function name:
    Please Login or Register  to view this content.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Cant count integer partitions by recursive function.

    Please Login or Register  to view this content.
    E.g,

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    1
    n \ k
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    2
    0
    1
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    C2: =Stirling2nd(n, k)
    3
    1
    0
    1
    0
    0
    0
    0
    0
    0
    0
    0
    0
    4
    2
    0
    1
    1
    0
    0
    0
    0
    0
    0
    0
    0
    5
    3
    0
    1
    3
    1
    0
    0
    0
    0
    0
    0
    0
    6
    4
    0
    1
    7
    6
    1
    0
    0
    0
    0
    0
    0
    7
    5
    0
    1
    15
    25
    10
    1
    0
    0
    0
    0
    0
    8
    6
    0
    1
    31
    90
    65
    15
    1
    0
    0
    0
    0
    9
    7
    0
    1
    63
    301
    350
    140
    21
    1
    0
    0
    0
    10
    8
    0
    1
    127
    966
    1,701
    1,050
    266
    28
    1
    0
    0
    11
    9
    0
    1
    255
    3,025
    7,770
    6,951
    2,646
    462
    36
    1
    0
    12
    10
    0
    1
    511
    9,330
    34,105
    42,525
    22,827
    5,880
    750
    45
    1
    Last edited by shg; 07-27-2019 at 03:31 PM.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Vlookup dosent work from right to left, whats my alternative?
    By Clooney003 in forum Excel General
    Replies: 2
    Last Post: 08-17-2017, 05:21 PM
  2. [SOLVED] VBA workbook change dosent work on formel. ?? - Need to react on calculation.
    By KSveigaard in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2017, 04:37 PM
  3. [SOLVED] Macro with filedialog dosent work in all workbooks
    By ATOP in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2016, 02:32 AM
  4. [SOLVED] INDEX dosent work???
    By ExcelBG in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-09-2013, 03:59 PM
  5. [SOLVED] Data validation with the table feature on another worksheet dosent work
    By Masun in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-29-2013, 06:54 AM
  6. input box dosent quite work
    By babar48 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2011, 07:33 PM
  7. why sum dosent work.
    By EXCEL NEWS in forum Excel General
    Replies: 9
    Last Post: 06-01-2005, 05:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1