Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9156793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:51:20+00:00 2026-06-17T12:51:20+00:00

Consider the following recursive factorial function: fact(n) = if (n = 0) return 1

  • 0

Consider the following recursive factorial function:

fact(n) =
    if (n = 0) return 1
    return n * fact(n - 1)

The above function converges for all positive integers including zero. However it doesn’t converge for negative integers.

Next, consider the following program:

fact(n) =
    if (n < 0) return 0
    if (n = 0) return 1
    return n * fact(n - 1)

The above function converges for all integers.

I wanted to know how would you statically determine whether or not a recursive function converges.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:51:22+00:00Added an answer on June 17, 2026 at 12:51 pm

    It’s a good thing that you didn’t specify a language and implied that you were thinking of unbounded integers, because it means I can point you to this prototype analyzer for a toy language available as a web app.

    With unbounded integers, rici is right, this is the halting problem. However, most other problems solved by static analyzers are also equivalent to the halting problem. That does not prevent the static analyzers in question from being useful. They work around the undecidability by accepting to have false negatives, false positives, or both.

    If you prefer to use a C-like syntax, you can also use Frama-C’s value analysis to determine whether a simple C program terminates. This analyzer does not handle recursive functions, and it treats integer types as bounded (which they are). Bounded integer types makes the problem easier in theory (for some definitions of the input language, it becomes decidable) but it is still hard in practice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following JavaScript code which has a recursive boom function function foo() {
Consider following make: all: a b a: echo a exit 1 b: echo b
Please suggest me the solution to the following problem consider a function function recurse(a):
I'm getting two problem when I call the recursive function inside a loop. Consider
Consider the following example. var obj = function(){}; function apply(target, obj) { if (target
Consider the following jQuery implementation defined using an object literal... $(function() { var myObject
consider the following code if insert() return the list itself. def sieve(l): if not
Consider following is the Node.js code: function My_function1(_params) { db.once('open', function (err){ //Do some
Consider following code: My problem is: 1) I can't seem to cast the errors
Consider following string Some string with quotes and \pre-slashed\ quotes Using regex, I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.