#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<math.h>
using namespace std;
// bien toan cuc
int n;
float x,y,z;
// dinh nghia cac ham
void Nhap();
long S1(int );
int TestTamGiac(float, float, float);
void TinhCV_DT(float, float,float);
float S2(float , float , float ,int);
void InSoNT(int);
// ham chinh
int main(){
 // goi ham Nhap
 // cau 1
 Nhap();
 //cau 2
 cout<<"\n S1= "<<S1(n);
 
 // cau 3
 if(TestTamGiac(x,y,z)==1) 
     cout<<"\n 3 so "<<x<<", "<<y<<", "<<z <<" la 3 canh cua tam giac";
  else
    cout<<"\n 3 so "<<x<<", "<<y<<", "<<z <<" khong phai 3 canh cua tam giac";
 
 // cau 4 
 TinhCV_DT(x,y,z);
 
 // cau 5
  cout<<"\n S2 = "<<S2(x,y,z,n);
  
// cau 6  
  InSoNT(n);
  
}
/* **************************** */ //khai bao cac ham
// Nhap x, y, z, n
void Nhap(){
 // nhap n
 do{
 cout<<"\n n ="; cin>>n;
 if(n<3||n>2000)
  cout<<"\n Nhap lai n! ";
 }while(n<3||n>2000);
 // nhap x,y,z
 cout<<"\n x ="; cin>>x;
 cout<<"\n y ="; cin>>y;
 do{
 cout<<"\n z ="; cin>>z;
 if(z==0)
  cout<<"\n Nhap lai z! ";
 }while(z==0);
}
// ham tinh giai thua
long TinhGT(int a){
 long gt=1;
 for(int i=1;i<=a;i++)
  gt*=i;
  return gt;
}
// ham tinh s1
long S1(int n){
 long s=0;
 for (int i=2;i<=2*n;i=i+2)
  s=s+TinhGT(i);
 return s;
 
}
// kiem tra tam giac
int TestTamGiac(float x, float y, float z){
 int test=0;
 if(x>0&&y>0&&z>0&&x+y>z&&x+z>y&&y+z>x)
   test =1;
 return test;
 
}
// tinh chu vi, dien tich
void TinhCV_DT(float x, float y,float z){
 float c, s;
 if(TestTamGiac(x,y,z) ==0)
  cout<<"\n Khong the tinh duoc chu vi, dien tich vi x,y,z khong phai 3 canh tam giac";
  else{
   c=x+y+z;
   float p=c/2;
   s=sqrt(p*(p-x)*(p-y)*(p-z));
   cout<<"\n Chu vi = "<<c;
   cout<<"\n Dien tich = "<<s;
  }
}
// ham tinh s2
float S2(float x, float y, float z,int n){
 float t=0;
 int i =1;
 while(i<=n){
 t=t+(pow(x,i)+i*y)/(i*z);
 i++;
 }
 return t;
}
// kiem tra so nguyen to
int TestSNT(int a){
 int test=1;
 if(a==1||a==2||a==3||a==5||a==7)
 return test;
 for(int i=2;i<a;i++)
  if(a%i==0) test=0;
 return test;
}
// In so nguyen to
void InSoNT(int  n){
 cout<<"\n In so nguyen to: ";
 if(n<7)
  cout<<"\n Khong ton tai so nguyen to thoa man dieu kien ";
  else 
   for(int i=7;i<n;i++)
     if(TestSNT(i)==1)
        cout<<i<<", ";
}