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

  • SEARCH
  • Home
  • 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 6944605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:19:42+00:00 2026-05-27T13:19:42+00:00

I am working on Project Euler and ran into an issue. I am unable

  • 0

I am working on Project Euler and ran into an issue.

I am unable to use a 1000 digit number and wanted to know if I am doing something wrong or am just going about this solution in the wrong way and if so what would be best approach be?

C#

namespace ToThePowerOf
{
    class Program
    {
        static void Main(string[] args)
        {
            BigInteger n = 1;
            int x = 0;
            BigInteger [] number;
            number = new BigInteger[149194];
            number[x] = 1;
            number[x + 1] = 1;
            x = 3; ;
            BigInteger check = 10000000000000000000000000000
                                0000000000000000000000000000000
                                0000000000000000000000000000000
                                0000000000000000000000000000000
                                0000000000000000000000000000000
                                0000000000000000000000000000000
                                0000000000000000000000000000000
                                0000000000000000000000000000000
                                0000000000000000000000000000000
                                00000000000000000000000;

            for (int i = 99; i > 0; i--)
            {
                n = (n - 1) + (n - 2);
                number[x] = n;
                x++;
                if (n > check)
                {
                    Console.WriteLine(x);
                }
            }
        }
    }
}
  • 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-05-27T13:19:43+00:00Added an answer on May 27, 2026 at 1:19 pm

    I’m guessing the ‘issue’ you ran into (would be helpful to include error message) is that the compiler doesn’t like the integer literal with 1000 digits so you can’t initialise it with a very large integer literal. As others have noted, breaking the integer literal into multiple lines isn’t valid either.

    The number[x] = 1; lines work because the compiler can handle the integer literal 1 and because we’re assigning it to a BigInteger it uses BigInteger‘s implicit operator to convert it to a BigInteger.


    One simple method to get around your problem with the big integer literal is to use the BigInteger.Parse method to create your 1000 digit number.

    BigInteger check = BigInteger.Parse("10000....", CultureInfo.InvariantCulture);
    

    Another method could be to initialise it with a small int, then use maths to get to the number you want, as in Jon Skeet’s answer.

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

Sidebar

Related Questions

I'm working on problem four of Project Euler and am running into a stackoverflow
I'm working on Project Euler problem number 205 which states: Peter has nine four-sided
I've started working on some Project Euler problems, and have solved number 4 with
I've been slowly working my way through the list of Project Euler problems, and
I'll try to be concise this time around! I'm still working Project Euler, this
I was working on Project Euler 40 , and was a bit bothered that
I'm working on Project Euler #14 in C and have figured out the basic
Once again working on Project Euler, this time my script just hangs there. I'm
I'm again working on Project Euler, this time problem #4. The point of this
I'm working on Project Euler to brush up on my C++ coding skills in

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.