Post view

Dev c++ Prog for Factorizing Odd Integers by Twinproducts and Squares IMPROVED VERSION in ENGLISH

//(C) Dr. Ulrike Ritter : Copies and changes demand explicit acceptance by the author

#include<stdio.h>

#include<conio.h>

#include<string.h>

#include <math.h>

#include <cstdlib>

#include <iostream>

#include<algorithm>

 

 

 

int main(void)

{

int abs;

int n;

int a1;

int a2;

int c1;

int c2;

int e2;

int e1;

int q1;

int a;

int b;

int c;

int d;

int h;

int d2;

int UB;

int OB;

 

 

std::cout <<"\n  Input Odd Integer for Output Difference Twinproduct minor Square  \n";

std::cout <<"a: \n";

std::cin >> a;

 

 

 

a1 = (a+1)/4;

a2 = (a-1)/4;

c1 = (a1*4-1);

c2 = (a2*4+1);

 

if (c1==a)

 

{

std::cout <<"\n   A is a +1 mod 4 integer. The difference-int is a1:  "<< a1 << "\n";

 

for (int n=1;n<9999;n++) 

{

 

for (d=1; d<9999; d++)

 

{q1 = d*d;

e1 = q1- n*(n+1);

UB=(2*n+1);

OB=(2*d);

 

 

if (e1==a1)

{

std::cout <<"  For a or a1 exist these squares and twinproducts:   \n";

 

std::cout <<"  As upper base d^2   " <<q1<< "  with base d:  " << d<< "\n";

 

std::cout <<"  and as lower base the twinproduct n*(n+1) :  "<<n*(n+1)<<"   with n =  " <<n<< "    \n";

 

std::cout <<"   Hence the integer a is =  "<< OB <<"^2 -  "  <<UB<<"^2 \n";

 

 

}}}

}

 

if (c2==a)

{

std::cout <<"\n   A is a -1 mod 4 integer. The difference-int is a2:  "<< a2 << "\n";

 

for (int n=1;n<9999;n++) 

{

for (int d=1; d<9999; d++)

{

q1 = d*d;

e2 = (n*(n+1)-q1);

OB=(2*n+1);

UB=(2*d);

 

if (e2==a2)

{

 

std::cout <<"  For a or a1 exist these squares and twinproducts:   \n";

 

std::cout <<"  As upper base the twinproduct n*(n+1) :  "<<n*(n+1)<<"   with n =  " <<n<< "    \n";

 

std::cout <<"  As lower base d^2   " <<q1<< "  with base d:  " << d<< "\n";

 

std::cout <<"   Hence the integer a is =  "<< OB <<"^2 -  "  <<UB<<"^2 \n";

}

}

}

}

}

 

Verlag 03.03.2018 1 400
Comments
Order by: 
Per page:
 
  •  Verlag: 
     
    If you have a fitting difference of a twinproduct and a square, just calculate the following equivalences to get the square difference that factorizes your number:
    example: diffenceInteger for 99 is 25 and
    99 is a +1 int.
    We find 9^2 as the upper square for 81-25 = 56
    and 7*8 as the twins for the lower base
    Now some equivalences:
    25 = 9^2 -7*8 //*4
    100 = 324 - 224 //-1
    100-1 = 18^2 - 224-1
    99 = 18^2 - (224+1)
    99 = 18^2 - 15^2
    third binominal formular :
    99 = (18+15)*(18-15)
    99 = 33*3
     
     03.03.2018 
    0 points
     
Post info
Rate
1 votes
Actions
Recommend
Categories
Books (9 posts)
Entertainment Blogs (11 posts)
Lifestyle (1 posts)
Tech News (3 posts)