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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:18:41+00:00 2026-05-31T00:18:41+00:00

I made a program to find the factors of a number: #include <iostream> #include

  • 0

I made a program to find the factors of a number:

#include <iostream>
#include <cmath>
using namespace::std;
int main() {
    long int n = 6008514751432;
    int i = 1;
    while (i <= n/2) {
        if (n % i == 0)
            cout << i << " ";
        i++;
    }
}

I am using xCode BTW
It works fine with smaller numbers, like 2000 lets say, or even 200000. But, when I get up to 6008514751432, which is the number I need to know, it doesn’t work, it just says the program is running and displays nothing! What is going on?

Update: When I run the program and wait about 2 minutes, it says:

Warning: the current language does not match this frame.
Current language:  auto; currently c++
(gdb) 
  • 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-31T00:18:43+00:00Added an answer on May 31, 2026 at 12:18 am

    Depending on your platform, you find that 6008514751432 is too large for the type long int. You need to make sure you are using a type that holds a 64-bit integer type.

    Also, if you are just trying to find the factors of a number, there is no need to look higher than sqrt(n) as factors greater than that have a corresponding co-factor less than that. Make sure to out the sqrt outside the loop itself.

    On a system where long int is larger than int, note that you’ll find that at some point i wraps to 0

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

Sidebar

Related Questions

Very simple question, I made the following program : #include <stdlib.h> int main(int argc,
I made a program to find if a number belongs to fibonacci series or
I am writing a program to find adapters, and have made a class called
i made a program that search logical drives to find a specific file .if
ft2build.h is located here: C:\Program Files\GnuWin32\include Initially, I made the same mistake as here:
I've been using my Activity class to access my DB which made my program
I can't find the program i made as in find i mean find without
Recently I'm writing a program using Qt(PyQt)'s QTableView. But I find that the current
I made a program using Eclipse, but I want to learn to compile it
I made a little program using my XBOX 360 kinect with the Kinect SDK

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.