Tag：Prime number

Time：2021624
Topic linkThere are two parameters base, number and number! How many zeros are there at the end of a number in base. for examplebase:10,number:10Then: 10= 3628800 with 2 zeros at the endbase:16,number:16Then: 16! = > Convert to hexadecimal = > 0x1307758000 with three zeros at the end thinking Find all prime factors of base, and […]

Time：2021612
Copy codeThe code is as follows: import re def is_prime(num): return not re.match(r”^1?$^(11+?)\1+$”, ‘1’ * num) This regular expression actually represents all “1” strings of aggregate length (including the special case “1”). (11+?) Denotes all integers greater than or equal to 2, followed by the following 1 + denotes repeated more than once – isn’t […]

Time：2021513
1、 Title: Topic link Let’s define DnIt is: Dn=pn+1−pnWhere piIs the ith prime. Obviously there is diFor n > 1, D ﹣ n ﹣ is even“ The prime pair conjecture holds that there are infinite pairs of adjacent prime numbers with difference of 2. Now any positive integer n (< 10) is given5), please calculate […]

Time：2021411
Find all prime numbers within one million The first method thinking: if the current number is I, then all the numbers smaller than int (sqrt (I)) + 1 can not be divisible. If yes, they are prime numbers theory: if we traverse all divisor J smaller than I and if J > int (sqrt (I)), […]

Time：202141
Title Requirements thinking Create an array mylist, the length of which is n, and initialize all elements of the array to true Create another array res to hold prime numbers The 0 subscript position of the array is assigned to FALS, indicating that 1 is not a prime number Traverse the array subscript 1 ~ […]

Time：2021325
Prime number:It is also called prime number, that is, a number greater than 1 and divisible only by 1 and itself Step idea:1. For traverses the loop to find other divisors2. If the setting satisfies the condition (the counter starts from 2, excluding itself), the output will be interrupted Demand 1: judge prime (quality) number […]

Time：2021218
Java introduction classic examples (1) 1、 According to the age, the people who print out the current age are teenagers (below 18), young people (1928), middleaged (2955) and old people (above 56).Upper code `import java.util.Scanner; public class TextDemo { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println (“please enter the age […]

Time：2021217
At the same time as the first emperor, eradose, the first person to measure the circumference of the earth, developed the eradose sieve method thinking In the given sequence (2N) table, all the multiples (not 0, 1, itself) of each element are erased, and all the prime numbers less than n are left Eradose sieve […]

Time：2021119
This regular expression is shown as follows: Regular expressions for checking prime numbers or not To use this positive regular expression, you need to convert the natural number into multiple 1 strings. For example, 2 should be written as “11”, 3 should be written as “111”, 17 should be written as “11111111111”. This kind of […]

Time：2021119
A more secure key generation method Diffie Hellman Before we talked about the problem of key distribution, the world is so dangerous that if we are not careful, the communication line will be monitored, so how can we transfer the key in such an insecure line? Here we introduce Diffie Hellman key exchange algorithm. This […]

Time：2021110
I haven’t written a blog for a long time. Recently, the project has been basically completed, and my daily study needs to be put on the agenda. Although there is no hope in the future, I’d better move forward with my head down… Don’t go into the topic. Dead cycle Soft crash:CPUoccupy100%, dual core50%The machine […]

Time：20201215
catalog:1. Simple recursive definition2. The difference and relation between recursion and loop3. Classical application of recursion 1. Simple recursive definition What is recursion? (first define a relatively simple statement, which may not be true for the sake of understanding) Recursion: infinitely call its own function, each call will change a key variable, until the key […]