WeChall_Prime Factory (Training, Math)
Your task is simple:
Find the first two primes above 1 million, whose separate digit sums are also prime.
As example take 23, which is a prime whose digit sum, 5, is also prime.
The solution is the concatination of the two numbers,
Example: If the first number is 1,234,567
and the second is 8,765,432,
your solution is 12345678765432
解题:
素数打表,依次从小到达剔除素数的倍数的数。
def allsum(x):
sum = 0
while x:
sum += x%10
x //= 10
return sum total = 2000000
prime = []
a = [1 for i in range(total)]
for i in range(2,total):
if a[i]:
prime.append(i)
time = 2
while 1:
num = time*i
if num >= total:
break
a[num] = 0
time += 1 find = 0
for i in range(1000000,total):
if i in prime and allsum(i) in prime:
print(i)
find += 1
if find == 2:
break
WeChall_Prime Factory (Training, Math)的更多相关文章
- WeChall_Prime Factory (Training, Math)Training: WWW-Robots (HTTP, Training)
In this little training challenge, you are going to learn about the Robots_exclusion_standard.The ro ...
- We Chall-Prime Factory-Writeup
MarkdownPad Document html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,ab ...
- wechall前十题
今天开始打一打wechall 累了打wechall,不累的时候开始打buu 第一题:Get Sourced 查看源代码即可,拉到底部 第二题:Stegano 属于misc的范畴,直接下载下来,然后no ...
- 0x00 Wechall writeup
目录 0x00 Wechall writeup Training: Get Sourced Training: ASCII Encodings: URL Training: Stegano I Tra ...
- HDU 6063 - RXD and math | 2017 Multi-University Training Contest 3
比赛时候面向过题队伍数目 打表- - 看了题解发现确实是这么回事,分析能力太差.. /* HDU 6063 - RXD and math [ 数学,规律 ] | 2017 Multi-Universi ...
- 2017 Multi-University Training Contest - Team 3——HDU6063 RXD and math
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6063 题目意思:字面意思,给出n,k,算出这个式子的答案. 思路:比赛的时候是打表找规律过了,赛后仔细 ...
- 【模拟退火】Petrozavodsk Winter Training Camp 2017 Day 1: Jagiellonian U Contest, Monday, January 30, 2017 Problem F. Factory
让你在平面上取一个点,使得其到给定的所有点的距离和最小. 就是“费马点”. 模拟退火……日后学习一下,这是从网上扒的,先存下. #include<iostream> #include< ...
- 【2017 Multi-University Training Contest - Team 3】RXD and math
[Link]: [Description] [Solution] 发现1010mod(109+7)=999999937; 猜测答案是nk 写个快速幂; 注意对底数先取模; [NumberOf WA] ...
- 2014 Multi-University Training Contest 9#6
2014 Multi-University Training Contest 9#6 Fast Matrix CalculationTime Limit: 2000/1000 MS (Java/Oth ...
随机推荐
- 关于Integer 和Double包装类创建对象时的底层解析
public void method1() { Integer i = new Integer(1); Integer j = new Integer(1); System.out.println(i ...
- Java零基础搭建实时直播平台
https://www.cnblogs.com/scywkl/p/12101437.html
- Flutter使用SingleTickerProviderStateMixin报错
最近在学习开发Flutter应用项目,在创建tabbar和tabview后,进行网络请求后显示顶部tab标签,设置TabController,并使class类实现SingleTickerProvide ...
- 1.常用的cmd命令
dir => 查看当前目录下的所有文件夹 cd.. => 返回上一级目录 cd/ => 返回根目录 cd 文件夹 => 打开当前目录下指定的子 ...
- 2018 CCPC 网络赛
The Power Cube is used as a stash of Exotic Power. There are n cities numbered 1,2,…,n where allowed ...
- RSA 的加密 解密
RSA加密解密类: package me.hao0.trace.order; import java.io.BufferedReader; import java.io.BufferedWriter; ...
- 《【面试突击】— Redis篇》--Redis Cluster及缓存使用和架构设计的常见问题
能坚持别人不能坚持的,才能拥有别人未曾拥有的.关注编程大道公众号,让我们一同坚持心中所想,一起成长!! <[面试突击]— Redis篇>--Redis Cluster及缓存使用和架构设计的 ...
- 本地Git绑定Github仓库
前言 Window的小伙伴如果还没在本地配好Git环境可以参考:https://www.cnblogs.com/poloyy/p/12185132.html 创建Github仓库 Github绑定本地 ...
- Activiti 手工任务(manualTask)
Activiti 手工任务(manualTask) 作者:Jesai 前言: 手工任务就是一个自动执行的过程.手动任务几乎不在程序中做什么事情,只是在流程的历史中留下一点痕迹,表明流程是走过某些节点的 ...
- Promise.finally
const Gen = (time) => { return new Promise((resolve, reject) => { setTimeout(function () { if( ...