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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:50:41+00:00 2026-06-17T17:50:41+00:00

Two points P and Q with coordinates (P x , P y ) and

  • 0

Two points P and Q with coordinates (Px, Py) and (Qx, Qy) satisfy the following properties:

  1. The coordinates Px, Py, Qx, and Qy are integers.
  2. Px = −Qx.
  3. The line PQ is tangent to a circle with center (0, 0) and radius r
  4. 0 < Px ≤ a for some integer limit a.

How do I find all such pairs of points P and Q?

For example, in the image below I have a circle with radius r=2 and the limit a = 6. The pair of points P = (6, 2) and Q = (−6, −7) are a solution, because:

  1. The coordinates of P and Q are integers.
  2. Px = −Qx.
  3. The line PQ is tangent to the circle.
  4. 0 < Px ≤ 6.

But this is just one pair. I need to find all such pairs. There are a finite number of solutions.

So, is there a way to check if coordinates of points are tangent to the circle and are integers, then to list them all? I’ve looked at slope equations and shortest path from the center of the circle to the line equations, however, in the first case it requires coordinates to be known (which I could do by brute forcing every single digit, but I cannot see the pattern, because my guts tell me there should be some sort of equation I should apply), and in the second case I have to know the slope equation.

This is the algorithm I came up with but I don’t think it is correct or good enough:

  1. Find the slope equation y = mx + b for all 1 ≤ Px ≤ a and −a ≤ Qx ≤ −1.
  2. For every y = mx + b check if it is tangent to the circle (how to do that???)
  3. If true, return the pair
  • 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-17T17:50:43+00:00Added an answer on June 17, 2026 at 5:50 pm

    Line PQ has equation:

    (x-Px)/(Qx-Px)=(y-Py)/(Qy-Py) or
    
    (x-Px)*(Qy-Py)-(y-Py)*(Qx-Px)=0 or
    
    x*(Qy-Py)+y*(Px-Qx)-Px*Qy+Px*Py+Py*Qx-Py*Px = 
    
    x*(Qy-Py)+y*2*Px-Px*(Qy+Py)=0
    

    Distance from zero point to this line (circle radius) is

    r=Px*(Qy+Py)/Sqrt((2*Px)^2+(Qy-Py)^2)
    

    Note that radius and nominator are integers, so denominator must be integer too. It is possible when 2*Px and |Qy-Py| are members of some Pythagorean triple (for your example – 12^2+9^2 =15^2).So you can use “Generating a triple” method from the above link to significantly reduce the search and find all the possible point pairs (with radius checking)

      Px = k * m * n   (for m>=n, radius < k*m*n <= a)
      |Qy-Py| = k * (m^2 - n^2)
    

    With a=6 max value of n is 2, and your example corresponds to (k, m, n) set of (3, 2, 1)

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

Sidebar

Related Questions

I need a fast algorithm for calculating coordinates for a line between two points.
Given two points in a 2D plane, and a circle of radius r that
I have two points that describe line, problem is that i know coordinates of
i have two points in 3D space which have X-coordinates with different signum. so
I have a large number of data points which are two dimensional coordinates with
Given two points in 3D space, A and B, I get a line segment
I have two points in the canvas, now I'm able to draw a line
I have two points at the end of a line. I need to get
Let's say I know two points that make up a line. I want to
A line is defined by two end points P1[x1, y1], P2[x2, y2]. Let Q

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.