Add to Favorites    Make Home Page 2832 Online
 Language Categories
 Source Codes Home Project Ideas New! Interview Questions FAQs Home ASP Home ASP Source Codes ASP Script Directory New! ASP .Net Script Directory New! ASP Interview Questions ASP FAQs ASP How Tos C Home C Source Codes C Script Directory New! C Interview Questions C FAQs C How Tos C++ Home C++ Source Codes C++ Script Directory New! C++ Interview Questions C++ FAQs C++ How Tos Java Home Java Source Codes Java Directory New! Java Interview Questions Java FAQs Java How Tos JavaScript Home JavaScript Directory New! JavaScript Source Codes JavaScript FAQs JavaScript How Tos COBOL Home COBOL Source Codes COBOL FAQs COBOL How Tos Pascal Home Pascal Source Codes Pascal FAQs Pascal How Tos PHP Script Directory New! Python Script Directory New! Perl & CGI Script Directory New! Flash Script Directory New! CFML Script Directory New! Remotely Hosted Scripts New! Tools & Utilities Directory New! XML Script Directory New! Best Programmers Amit Mathur Vishal Bhardwaj Deepesh Jain Vyom NetWork
 Our Services

Home » C++ Home » Mathematics Home » Printing Ramanujan Numbers 1-100 RN=L^3+M^3=N^3+P^3

A D V E R T I S E M E N T

Search Projects & Source Codes:

 Title Printing Ramanujan Numbers 1-100 RN=L^3+M^3=N^3+P^3 Author Mahender Author Email mahender.k [at] gmail.com Description This programme Prints the first 100 Ramanujan NUMBERSand satisfying the formula:-RN=L^3+M^3=N^3+P^3RN- Ramanujan Numbersand L!=M!=!N=!P Category C++ » Mathematics Hits 382284 Code Select and Copy the Code Code : /* Description: Programme to Print first 100 Ramanujan Numbers by TWO WAYS 1st way is printing Ramunajan Numbers from RN taking RN from 0 to INFINITY and print first 100 numbers. 2nd way is to clacualte RN numbers from L M N P of formula RN= L^3 + M^3 = N^3 + P^3 and sort the RN numbers and print first 100 Numbers RN=RAMANUJAN NUMBERS */ #include //Include Header Files #include using namespace std; template X cube(X a)//TEMPLATE to calculate CUBE of a number and { //Return the CUBE return (a*a*a);//Return CUBE } class Ramanujan{//CLASS to PRINT RN in two ways public: void fromRN();//PRINT RN from RN void fromLMNP();//PRINT RN from LMNP values }; void Ramanujan::fromLMNP()//Start of LMNP { int L=0,M=0,N=0,P=0;//integer L,M,N,P to calculate RN int a[200];//ARRAY to store RN calculated from L,M,N,P int temp;//Integer to SWAP for sorting. int i=0,j=0;//Integer's for sorting ARRAY int CAL;//Integer to store how many values calculated for RN cout<<" Calculating RN numbers from LMNP values Please Wait......... "; for(L=0;L<128;L++)//L for(M=0;M<170;M++)//M for(N=0;N<170;N++)//N for(P=0;P<205;P++)//P {if(L0&&care==0;k--){//LOOP to find M value h=(int)k; mc=((int)(ri-cube(h))); mk=(pow(mc,l)); m=(int)mk; if(m=m;j--) if((cube(i)+cube(j))==cube(m)+cube(h))//if FINDED NP also {//then check the condition if(i!=j&&i!=h&&i!=m&&j!=h&&j!=m&&h!=m&&(double)(cube(h)+cube(m))==ri&&(dou ble)(cube(i)+cube(j))==ri) {if(kmk==0){//if LMNP if found then PRINT RN //printf(" %d: %d %d %d %d = %d",flag,i,j,h,m,ri); cout<<" "<>choice;//USER to select choice if(choice=='1')//If choice 1 then print RN from RN number { rn.fromRN();//calling member to print RN from RN number cout<<" Do you want to Continue(y or Y) else Any key to exit :"; cin>>choice; } else if(choice=='2')//If choice 2 then print RN from LNMP { rn.fromLMNP();//calling member to print print RN from LNMP values cout<<" Do you want to Continue(y or Y) else Any key to exit :"; cin>>choice; } else if(choice=='3')//to QUIT { cout<<" Bye:.............. "; } else//if worng choice entered { cout<<" You Entered Wrong Choice Please select correct "; cout<<" Do you want to Continue(y or Y) else Any key to exit :"; cin>>choice; } }while(choice=='y'||choice=='Y');//condition for choice return 0; //return 0 } //End of main Programme

Related Source Codes

 Script Name Author Moving ball screen saver karlmarx The Classic Game of Snake & Ladder Lakshmi Narayana .A Railway seat reservation question which comes in sapient VyomWorld To calculate percentile Ravi Mathur Send to folder ANIMESH SAHU Analog clock and calendar Nazia & Rida HIGH/LOW GAME MOLLY ARORA Data structure (stack Implimentation) Swapnil B Adsure Memory Game AnirudhSanyal Easy Calc Anirudh Sanyal GK Quiz Anirudh Sanyal Hangman Game Manish Jain Snakeman Manish Jain Full month Calendar Nigi Cursor shapes nigi

A D V E R T I S E M E N T

Subscribe to SourceCodesWorld - Techies Talk
Email:

 Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home