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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:17:02+00:00 2026-06-12T02:17:02+00:00

Problem: Find the number of integers 1 < n < 10^7, for which n

  • 0

Problem: Find the number of integers 1 < n < 10^7, for which n and n + 1 have the same number of positive divisors. For example, 14 has the positive divisors 1, 2, 7, 14 while 15 has 1, 3, 5, 15.

I can’t reach 10^7 because it is too big number for C and me. How can i solve this problem in C?

#include<stdio.h>
#include<conio.h>

int divisorcount(int);

int main()
{
    int number,divisornumber1,divisornumber2,j=0;

    for(number=1;number<=100;number++){
        divisornumber1=divisorcount(number);
        divisornumber2=divisorcount(number-1);
        if(divisornumber1==divisornumber2){
            printf("%d and %d\n",number-1,number);
            j++;
        }
    }
    printf("\nThere is %d integers.",j);

    getch();
}

int divisorcount(int num)
{
    int i,divi=0;
    for(i=1;i<=(num)/2;i++)
        if(num%i==0)
            divi++;
    return divi;
}
  • 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-12T02:17:03+00:00Added an answer on June 12, 2026 at 2:17 am

    Ever tried long long num = 100000000LL;? C isn’t smart enough to conclude the type on the right side from the left long long so you have to add the LL. With this approach you should be able to handle larger numbers than normal integers, just change your functions and variables in a suitable way.

    A long long is always at least 2^64 bit in size which you can check on Wikipedia.

    Hint: As someone mentioned in the comments, Project Euler is not about bruteforcing. This is a lame approach. Think about some better strategies. You might want to get help at math.stackexchange?

    EDIT: I don’t know why I thought, that a uint32_t is not enough for 10^7 – sorry for that mistake.

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

Sidebar

Related Questions

Problem statement: Find the right triangle that has integers for all sides and all
I'm looking for an algorithm which can take two sets of integers (both positive
I am have difficulties solving this problem: For a positive number n, define C(n)
I have the following problem: I need to find pairs of the same elements
i have this problem to find a particular xml node l have post this
Earlier today I asked similar problem to find the maximum element which is common
My problem is to find best view configuration for my application that have a
I can't find the problem. Why is this code making many copies of the
I have a very simple problem but cannot find a nice solution. I have
This is probably really stupid but i can't find the problem with my code.

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.