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 7766239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:21:50+00:00 2026-06-01T15:21:50+00:00

I am trying to generate nth bell number for large values between 500 to

  • 0

I am trying to generate nth bell number for large values between 500 to 1000.

Bells number is huge and i can’t store it in ulong.

(To know bells number: http://en.wikipedia.org/wiki/Bell_number)

I tried the triangular method to compute the number.

Can any temme a way to save huge numbers like dat and perform the operation.

Here is the Code i wrote


using System;

class Program    
{        
    static void Main(string[] args)
    {
        int length;
        do
        {
            length =-1;                
            string numLength= Console.ReadLine();
            if (int.TryParse(numLength, out length))
            {   
                Console.WriteLine("Sequence length is : {0}",
                                           TriangularMethod(length));
            }
        }while(length>0);
    }

    static ulong TriangularMethod(int n)
    {
        Dictionary<long, List<ulong>> triangle = 
                                new Dictionary<long, List<ulong>>();
        triangle.Add(1, new List<ulong>(new ulong[] { 1 }));

        for (int i = 2; i <= n; i++)
        {
            triangle.Add(i, new List<ulong>());
            triangle[i].Add(triangle[i - 1].Last());
            ulong lastVal = 0;
            for (int k = 1; k < i; k++)
            {
                lastVal = triangle[i][k - 1] + triangle[i - 1][k - 1];
                triangle[i].Add(lastVal);                    
            }

            triangle.Remove(i - 2);
        }
        return triangle[n].Last();
    }        
}

If there is a faster way to compute the same. please temme.

  • 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-01T15:21:51+00:00Added an answer on June 1, 2026 at 3:21 pm

    use BigInteger Structure available in namespace System.Numerics

    I think this would be useful to you

    http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx

    working with incredibly large numbers in .NET

    http://www.codeproject.com/Articles/2728/C-BigInteger-Class

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

Sidebar

Related Questions

I'm trying to generate random number between 0 and 40(inclusive). So the code I
I am trying to generate an array with N integer values between 0 and
I am trying to generate a list of all possible number combinations within a
Im trying to generate n unique random numbers between 1 and max I tried
I'm trying to generate a token so I can get access to a server
I'm trying to generate a unique ID in php in order to store user-uploaded
Im trying to generate a color gradient using ColdFusion. My current code below works
I trying to generate an XML document which is around 23 to 30 MB,
I am trying to generate a URL that contains a UNC path as one
I am trying to generate an xml file of a recipe database that has

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.