首页 > 编程知识 正文

素数是自然数吗,俄罗斯鬼娃娃

时间:2023-05-06 03:12:17 阅读:247400 作者:2974

自然数 素数 质数

As a child, weren’t you in wonder of Russian Dolls, and where you learnt how the dolls fitted into each other? I bet you still pass a Russian Doll at a market, and remember the time you played with them, and perhaps even think about buying one.

小时候,您不是对俄罗斯fkdgtx感到好奇吗?您在哪里学到的fkdgtx是如何装配在一起的? 我敢打赌,您仍然在市场上走过俄罗斯fkdgtx,还记得您和他们玩的时间,甚至可能考虑购买一个。

And so where else can we find Russian Dolls? Well, within prime numbers we have a similar concept — known as truncatable primes — and where we can peal numbers off from the left or right, and still reveal a prime number.

那么我们还能在哪里找到俄罗斯fkdgtx呢? 好吧,在质数内,我们有一个类似的概念(称为可截断的质数),在这里我们可以从左或右剥离数字,并仍然显示质数。

A left-truncatable prime (or Russian Doll prime) is defined as a prime number, that when we take away the leading left digit successively, it still reveals a prime number. For example, 197 is a left-truncable prime as 197, 97 and 7 are primes, but 311 is not left-truncatable prime as 331 is a prime, 31 is a prime, but 1 is not a prime. A right-truncatable prime is defined as a prime number which, when taking away the end right digit successively, reveals numbers which are prime. 379 is an example of a right-truncatable prime, since 379, 37, and 3 are all prime.

可素数素(或俄罗斯fkdgtx素素)定义为素数,当我们连续拿走左数前导数时,它仍显示素数。 例如,197是左截尾素数,因为197、97和7是素数,但是311不是左截尾素数,因为331是素数,31是素数,但是1不是素数。 可右截断的质数被定义为质数,当连续取下右端数字时,该质数显示为质数。 379是右截断素数的示例,因为379、37和3都是素数。

A value of 5,555 reveals the following [here]:

值5,555揭示了以下[ 这里 ]:

Maximum prime: 5531Left-truncatable primes:
[2, 3, 5, 7, 13, 17, 23, 37, 43, 47, 53, 67, 73, 83, 97, 113, 137, 167, 173, 197, 223, 283, 313, 317, 337, 347, 353, 367, 373, 383, 397, 443, 467, 523, 547, 613, 617, 643, 647, 653, 673, 683, 743, 773, 797, 823, 853, 883, 937, 947, 953, 967, 983, 997, 1223, 1283, 1367, 1373, 1523, 1613, 1823, 1997, 2113, 2137, 2347, 2383, 2467, 2617, 2647, 2683, 2797, 2953, 3137, 3167, 3313, 3347, 3373, 3467, 3547, 3613, 3617, 3643, 3673, 3797, 3823, 3853, 3947, 3967, 4283, 4337, 4373, 4397, 4523, 4547, 4643, 4673, 4937, 4967, 5113, 5167, 5197, 5347, 5443]Right-truncatable primes:
[2, 3, 5, 7, 23, 29, 31, 37, 53, 59, 71, 73, 79, 233, 239, 293, 311, 313, 317, 373, 379, 593, 599, 719, 733, 739, 797, 2333, 2339, 2393, 2399, 2939, 3119, 3137, 3733, 3739, 3793, 3797]Left- and Right-truncatable primes:
[2, 3, 5, 7, 23, 37, 53, 73, 313, 317, 373, 797, 3137, 3797]

The numbers that are left- and right-trucated primes areknown as two-sided primes and are: { 2, 3, 5, 7, 23, 37, 53, 73, 3797, 313, 373, 797, 797, 3137, 3797, 739397 }.

左向质数的素数称为双面质数 ,分别为:{2、3、5、7、23、37、53、73、3797、313、373、797、797、3137、3797 ,739397}。

The following outlines some sample code [here]:

下面概述了一些示例代码[ here ]:

from sympy import sieve
import sysn=4201if (len(sys.argv)>1):
n=int(sys.argv[1])if (n>10000): sys.Exit(1)truncateleft=[]
truncateright=[]primelist = [str(x) for x in list(sieve.primerange(1, n))]
primeset = set(primelist)for n in primelist:
alltruncs = set(n[i:] for i in range(len(n)))
if alltruncs.issubset(primeset):
truncateleft.append(int(n))print ("Maximum prime: ",n)print ("nLeft-truncatable primes:")
print (truncateleft)for n in primelist:
alltruncs = set(n[:i+1] for i in range(len(n)))
if alltruncs.issubset(primeset):
truncateright.append(int(n))print ("nRight-truncatable primes:")
print (truncateright)print ("nLeft- and Right-truncatable primes:")res = set(truncateleft).intersection(set(truncateright))
print (sorted(res, key=int))

And here is the running code:

这是运行代码:

演示地址

Oh, you have gotta love Russian Dolls, Python, and prime numbers!

哦,您一定喜欢俄罗斯fkdgtx,Python和质数!

翻译自: https://medium.com/asecuritysite-when-bob-met-brdhl/russian-doll-prime-numbers-419490269413

自然数 素数 质数

css3如何实现花边边框

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。