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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:08:00+00:00 2026-06-09T08:08:00+00:00

I am trying to find certain coordinates of interest within a very large virtual

  • 0

I am trying to find certain coordinates of interest within a very large virtual grid. This grid does not actually exist in memory since the dimensions are huge. For the sake of this question, let’s assume those dimensions to be (Width x Height) = (Int32.MaxValue x Int32.MaxValue).

  1   2   3   4   5   6   7   8   9  10
  2   4   6   8  10  12  14  16  18  20
  3   6   9  12  15  18  21  24  27  30
  4   8  12  16  20  24  28  32  36  40
  5  10  15  20  25  30  35  40  45  50
  6  12  18  24  30  36  42  48  54  60
  7  14  21  28  35  42  49  56  63  70
  8  16  24  32  40  48  56  64  72  80
  9  18  27  36  45  54  63  72  81  90
 10  20  30  40  50  60  70  80  90 100

Known data about grid:

  • Dimensions of the grid = (Int32.MaxValue x Int32.MaxValue).
  • Value at any given (x, y) coordinate = Product of X and Y = (x * y).

Given the above large set of finite numbers, I need to calculate a set of coordinates whose value (x * y) is a power of e. Let’s say e is 2 in this case.

Since looping through the grid is not an option, I thought about looping through:

int n = 0;
long r = 0;
List<long> powers = new List<long>();
while (r < (Int32.MaxValue * Int32.MaxValue))
{
    r = Math.Pow(e, n++);
    powers.Add(r);
}

This gives us a unique set of powers. I now need to find out at what coordinates each power exists. Let’s take 2^3=8. As shown in the grid above, 8 exists in 4 coordinates: (8,1), (4,2), (2,4) & (1, 8).

Clearly the problem here is finding multiple factors of the number 8 but this would become impractical for larger numbers. Is there another way to achieve this and am I missing something?

  • Using sets won’t work since the factors don’t exist in memory.
  • Is there a creative way to factor knowing that the number in question will always be a power of e?
  • 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-09T08:08:01+00:00Added an answer on June 9, 2026 at 8:08 am

    Another solution, not as sophisticated as the idea from Commodore63, but therefore maybe a little bit simpler (no need to do a prime factorization and calculating all proper subsets):

    const int MaxX = 50;
    const int MaxY = 50;
    const int b = 6;
    
    var maxExponent = (int)Math.Log((long)MaxX * MaxY, b);
    
    var result = new List<Tuple<int, int>>[maxExponent + 1];
    for (var i = 0; i < result.Length; ++i)
      result[i] = new List<Tuple<int, int>>();
    
    // Add the trivial case
    result[0].Add(Tuple.Create(1, 1));
    
    // Add all (x,y) with x*y = b
    for (var factor = 1; factor <= (int)Math.Sqrt(b); ++factor)
      if (b % factor == 0)
        result[1].Add(Tuple.Create(factor, b / factor));
    
    // Now handle the rest, meaning x > b, y <= x, x != 1, y != 1
    for (var x = b; x <= MaxX; ++x) {
      if (x % b != 0)
        continue;
    
      // Get the max exponent for b in x and the remaining factor
      int exp = 1;
      int lastFactor = x / b;
      while (lastFactor >= b && lastFactor % b == 0) {
        ++exp;
        lastFactor = lastFactor / b;
      }
    
      if (lastFactor > 1) {
        // Find 1 < y < b with x*y yielding a power of b
        for (var y = 2; y < b; ++y)
          if (lastFactor * y == b)
            result[exp + 1].Add(Tuple.Create(x, y));
      } else {
        // lastFactor == 1 meaning that x is a power of b
        // that means that y has to be a power of b (with y <= x)
        for (var k = 1; k <= exp; ++k)
          result[exp + k].Add(Tuple.Create(x, (int)Math.Pow(b, k)));
      }
    }
    
    // Output the result
    for (var i = 0; i < result.Length; ++i) {
      Console.WriteLine("Exponent {0} - Power {1}:", i, Math.Pow(b, i));
      foreach (var pair in result[i]) {
        Console.WriteLine("  {0}", pair);
        //if (pair.Item1 != pair.Item2)
        //  Console.WriteLine("  ({0}, {1})", pair.Item2, pair.Item1);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to find the sourcesites that ONLY exist before a certain timestamp.
Not a competition, it is instead me trying to find why a certain regex
I am trying to find events on certain days with this code: Event.where('starttime BETWEEN
I'm trying to find certain strings in a lot of files (cc. 2000 files).
i am trying to find a certain tag in a html-page with java. all
I have a lot of nested dictionaries, I am trying to find a certain
I am really having trouble trying to figure out how to find certain records
I have a web application project. I am trying to find out why certain
I'm trying to find out the time between certain fields in my tables. However
I am trying to find all the digits following a certain String pattern using

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.