0% found this document useful (0 votes)
7 views9 pages

Chuyen de So Nguyen To

Uploaded by

dvu01125d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views9 pages

Chuyen de So Nguyen To

Uploaded by

dvu01125d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

#include <bits/stdc++.

h>

using namespace std;


bool ktsnt(long long n)
{
if(n<2) return false;
for(int i=2;i*i<=n;i++)
if(n%i==0) return false;
return true;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n;
cin>>n;
cout<<ktsnt(n);
}

#include <bits/stdc++.h>
using namespace std;

int a[10000000];

void sang(){
for(int i=0;i<=10000000;i++){
a[i]=1;
}
a[0]=a[1]=0;
for(int i=2;i<=sqrt(10000000);i++){
if(a[i]){
for(int j=i*i;j<=10000000;j+=i){
a[j]=0;
}
}
}
}

int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
sang();
for(int i=1;i<n;i++){
if(a[i]){
cout<<i<<" ";
}
}
}

#include <bits/stdc++.h>
using namespace std;
long long n;
int a[10000000];

void sang(){
for(int i=2;i*i<=n;i++)
{
int mu=0;
while(n%i==0)
{
mu++;
n/=i;
}
if(mu>0) cout<<i<<" ^ "<<mu;
cout<<" * ";
}
if(n>1) cout<<n<<" ^ "<<1;
}

int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n;
sang();
}
#include <bits/stdc++.h>

using namespace std;

int main()
{ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
bool x=1;
cin>>n;
while(n>0){
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
x=0;
}
}
if(n<2){
x=0;
}
if(x==0){
cout<<"FALSE";
break;
}
n/=10;
}
if(x==1){
cout<<"TRUE";
}
return 0;
}

#include <bits/stdc++.h>

using namespace std;

long long a[10000000];

void sang()

for(int i=2;i<=10000000;i++)

{
a[i]=1;

for(int i=1;i*i<=10000000;i++)

if(a[i])

for(int j=i*i;j<=10000000;j+=i)

a[j]=0;

int main()

long long n;

cin>>n;

sang();

for(int i=2;i<=n;i++)

if(a[i])

for(int j=2;j<=n;j++)

if(pow(2,j)-1==i)

cout<<i<<" ";

#include <bits/stdc++.h>
using namespace std;
bool kt(int n) {
if (n < 2) return false;
for (int i = 2; i * i <= n; ++i) {
if (n % i == 0) return false;
}
return true;
}
int main() {
int n;
cin>>n;
bool lc=true;
for (int i = 2; i < n; ++i)
if (kt(i)==1&&kt(i+2)==1)
{
if(!lc) cout<<",";
cout<<"("<<i<<","<<i+2<<")";
lc=false;
}

#include <bits/stdc++.h>
using namespace std;
int a[1000000];
int n,i=2,dem=0;
bool snt(int n) {
if (n < 2) return false;
for (int i = 2; i * i <= n; ++i) {
if (n % i == 0) return false;
}
return true;
}
int stt(int n) {
int dem = 0, so = 2;
while (true) {
if (snt(so)) {
++dem;
if (dem == n) return so;
}
++so;
}
}
int main() {

cin>>n;
while(dem<=n)
{
int x=1;
for (int j = 2; j * j <= i; ++j)
if (i % j == 0) x=0;
if(x==1)
{
dem++;
a[dem]=i;
}
i++;
}
cout<<a[n];
}
#include <bits/stdc++.h>

using namespace std;


long long a[10000000];
void sang()
{
for(int i=2;i<=10000000;i++)
{
a[i]=1;
}
for(int i=1;i*i<=10000000;i++)
if(a[i])
for(int j=i*i;j<=10000000;j+=i)
{
a[j]=0;
}
}
int main()
{
long long c,b,t=0;
cin>>c>>b;
sang();
for(int i=c;i<=b;i++)
{
if(a[i])
{
t+=i;
}
}
cout<<t;
}

#include <bits/stdc++.h>
using namespace std;
long long n,a[10000000];
void sang()
{
for(int i=2;i<=10000000;i++)
{
a[i]=1;
}
for(int i=1;i*i<=10000000;i++)
if(a[i])
for(int j=i*i;j<=10000000;j+=i)
{
a[j]=0;
}
}
bool ktdx(int n) {
int nguyenban = n;
int sodx = 0;
while (n > 0) {
int m = n % 10;
sodx = sodx * 10 + m;
n /= 10;
}
return nguyenban == sodx;
}
int main()
{
cin>>n;
sang();
bool lc=true;
for(int i=2;i<=n;i++)
{
if(a[i])
{
if(ktdx(i))
{
if(!lc) cout<<",";
cout<<i;
lc=false;
}
}
}
}

#include <bits/stdc++.h>

using namespace std;


int main()
{
long long n;
bool lc=true;
cin>>n;
long long a[6] = {3, 5, 17, 257, 65537, 4294967297};
for(int i=0;i<6;i++)
{
if(n>a[i])
{
if(!lc) cout<<",";
cout<<a[i];
lc=false;
}

}
}

*giải thích:
#include <bits/stdc++.h>

using namespace std;

long long p, a[10000000];

void sang()

fill(a, a + 10000000, true);

a[0] = a[1] = false;

for (int i = 2; i * i < 10000000; ++i) {

if (a[i]) {for (int j = i * i; j < 10000000; j += i) {a[j] = false;} }


}

int main()

cin>>p;

sang();

long long m = (1LL << p) + 1;

if(m<10000000&&a[m]) cout<<"TRUE";

else cout<<"FALSE";

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy