当前位置:网站首页>Conjecture of prime pairs in C language
Conjecture of prime pairs in C language
2022-06-30 01:31:00 【Martin の Blog】

Algorithm design ideas
- Get prime ( Be careful , This part of the course has run timeout , Use sqrt Can solve )
- Judge whether prime numbers are adjacent
- Print the results
Code
#include <stdio.h>
#include <math.h>
int issushu(int x){
int count = 0;
for(int i=2; i<sqrt(x)+1; i++){
if(x % i==0){
return 0;
}
}
return 1;
}
int main(){
int n, i;
int x=0;
scanf("%d", &n);
for(i=5; i<=n; i++){
if(issushu(i-2) && issushu(i)){
x++;
}
}
printf("%d", x);
return 0;
}
Running results 
边栏推荐
- Pytroch Learning Notes 6: NN network layer convolution layer
- 手势数字启蒙学习机
- Can mango hypermedia, which "braves the wind and waves", go ashore?
- 【535. TinyURL 的加密与解密】
- Varnish 基础概览2
- js内容混淆,返回内容加密
- Machine learning notes: time series decomposition STL
- Pytorch中transforms的用法整理
- What to remember about the penalty for deduction of points in Item 1
- 关于c语言main函数中int argc,char **argv的理解
猜你喜欢

What should be paid attention to in the design and production of the Urban Planning Museum

cookie加密11

cookie加密8

Cookie encryption 10

Pytroch Learning Notes 6: NN network layer convolution layer
![【图神经网络】图分类学习研究综述[3]:图分类方法评价及未来研究方向](/img/b1/2afa73a14b2f41b7a65c4c2d261e6a.png)
【图神经网络】图分类学习研究综述[3]:图分类方法评价及未来研究方向

Cookie加密15 登录加密

I, 33 years old, ByteDance test development, unveiled the real income of Beijing "test post"

画画水族馆的应用特色及功能

Embedded test template
随机推荐
【机器学习Q&A】余弦相似度、余弦距离、欧式距离以及机器学习中距离的含义
How does webapi relate to the database of MS SQL?
The first technology podcast month will begin soon
Understanding of int argc, char * * argv in C language main function
Embedded exit (review and release)
画画水族馆的应用特色及功能
postman 之接口关联
Cookie加密12
Module import reload method
[recommendation system] concise principle and code implementation of user based collaborative filtering
Pytorch中transforms的用法整理
Cookie加密10
Varnish 基础概览3
Varnish foundation overview 1
“乘风破浪”的芒果超媒,能上岸吗?
Embedded test template
C language selection, loop overview
Varnish 基础概览5
Preliminary understanding of NVIDIA Jetson nano
Design and implementation of spark offline development framework