The basic algorithm of C language 26-Pell equation solution

Source: Internet
Author: User

Poor Lifting Method!
/*
======================================================
Title: Solving the X*x-73*y*y=1 equation of the Pell.
======================================================
*/
#include <stdio.h>
#include <math.h>
int main (void)
{
int x, y;
Double T;
for (y=1;y<=10000000;y++)
{
T=1.0+73.0*y*y;
x= (int) sqrt (t);
if ((x<10000000) && (1.0*x*x==t))
printf ("x=%8d y=%8d \ n", x, y);
}
return 0;
}
/*
======================================================
Evaluation:

In fact, it's a poor lifting Method! The key is to choose an intermediate amount so that both X and Y are close to this value, and

We convert the two-dollar equation into Yi Yuanfang! The T in question has the effect of avoiding overflow

Out, causing the wrong solution!

======================================================
*/

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The basic algorithm of C language 26-Pell equation solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.