Hướng dẫn composite number in range python - số tổng hợp trong dãy python

Composite Numbers in the range

You are given two integers 

M, N as input. Write a program to print all the composite numbers present in the given range (including M and N).

Input

The first line of input is an integer 

M. The second line of input is an integer N.

Explanation

In the given example, the composite numbers present in the range between 

2 to 9 are 4, 6, 8, 9.

So, the output should be

4
6
8
9
Sample Input 1
2
9
Sample Output 1
4
6
8
9
Sample Input 2
1
4
Sample Output 2
4

Show

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)

Tìm hiểu thêm về sự giúp đỡ của chúng tôi với các bài tập: Python

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
59
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
94

Ví dụ: & nbsp; 

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers

Giải pháp là ít khó khăn. Vì có nhiều câu trả lời có thể, chúng tôi thảo luận về một giải pháp tổng quát ở đây. & Nbsp; & nbsp;

Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]

Ví dụ cho thuật toán trên & nbsp;

n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites

C++

#include <bits/stdc++.h>

using namespace std;

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
1
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
6
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
7

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
3

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
6
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
1

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
3

Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
4
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
5
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
6
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
7
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
8
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
9
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
2

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
5

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
9

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
[122, 124]
1

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
2

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

Java

[122, 124]
6
[122, 124]
7

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5#include <bits/stdc++.h>0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0 #include <bits/stdc++.h>2
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
6 #include <bits/stdc++.h>9using0using1

using2

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9 using4
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9 using8using4namespace0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5#include <bits/stdc++.h>0 namespace5
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
6____10
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

________ 91 ________ 10 & nbsp; std;3std;4std;5__94

________ 91 ________ 10 & nbsp;

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
00using4
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
0

std;1

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
04
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
06
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
7
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
08
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
9namespace0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
14 #include <bits/stdc++.h>0 namespace5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
17
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
18
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
19

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
24
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
25
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
[122, 124]
1

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

Python3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
32
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
33

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
35
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
36 using4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
39
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
40
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
41
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
42
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
43__

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
35
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
51
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
36
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
53

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
56

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
32
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
58

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
35
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
36
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
62
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
46 std;4__

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
69
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
36
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
35
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
46
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
73
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
74 using4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
77
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
43
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
46
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
81
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
82
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
46
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
7
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
46
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
81
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
87
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
46
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
9using1

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
73
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
36
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
25

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
94

C#

using

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
96

[122, 124]
6
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
98

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5#include <bits/stdc++.h>0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0 #include <bits/stdc++.h>2
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
6 #include <bits/stdc++.h>9using0using1

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5#include <bits/stdc++.h>0 namespace5
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
6____10
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

________ 91 ________ 10 & nbsp; std;3std;4std;5__94

________ 91 ________ 10 & nbsp;

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
00using4
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
0

std;1

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
04
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
06
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
7
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
08
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
9namespace0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
14 #include <bits/stdc++.h>0 namespace5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
17
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
18
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
19

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
24
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
25
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
32
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
33

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
[122, 124]
1

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
35
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
36 using4

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input()) N = int(input()) for number in range(M,N+1):    count = 0    #divisor search, do not count the number itself and 1    for divider in range(2,number//2+1):      if number%divider == 0:        count+=1    if count >= 1:      print(number)5M = int(input()) N = int(input()) for number in range(M,N+1):    count = 0    #divisor search, do not count the number itself and 1    for divider in range(2,number//2+1):      if number%divider == 0:        count+=1    if count >= 1:      print(number)39 M = int(input()) N = int(input()) for number in range(M,N+1):    count = 0    #divisor search, do not count the number itself and 1    for divider in range(2,number//2+1):      if number%divider == 0:        count+=1    if count >= 1:      print(number)40M = int(input()) N = int(input()) for number in range(M,N+1):    count = 0    #divisor search, do not count the number itself and 1    for divider in range(2,number//2+1):      if number%divider == 0:        count+=1    if count >= 1:      print(number)41 M = int(input()) N = int(input()) for number in range(M,N+1):    count = 0    #divisor search, do not count the number itself and 1    for divider in range(2,number//2+1):      if number%divider == 0:        count+=1    if count >= 1:      print(number)42M = int(input()) N = int(input()) for number in range(M,N+1):    count = 0    #divisor search, do not count the number itself and 1    for divider in range(2,number//2+1):      if number%divider == 0:        count+=1    if count >= 1:      print(number)43__

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
58

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
35
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
51
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
36
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
53

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
56

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
3

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
6
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
1

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
3

Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
4
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
5
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
6
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
7
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
8
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
9
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
2

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
5

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
6
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
61namespace0

Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
13

M = int(input()) N = int(input()) for number in range(M,N+1):    count = 0    #divisor search, do not count the number itself and 1    for divider in range(2,number//2+1):      if number%divider == 0:        count+=1    if count >= 1:      print(number)5M = int(input()) N = int(input()) for number in range(M,N+1):    count = 0    #divisor search, do not count the number itself and 1    for divider in range(2,number//2+1):      if number%divider == 0:        count+=1    if count >= 1:      print(number)0 n = 3 Then a = (n+2)! + 2 a = 5! + 2 a + 1 = 5! + 3 a + 2 = 5! + 4 Here a is divisible by 2 Here a + 1 is divisible by 3 Here a + 2 is divisible by 4 Hence a, a+1, a+2 are all composites9

Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
14

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
2

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
6
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
7

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
8
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
0

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
3

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
6
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
3

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
4

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
32

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
34

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
36

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
9
n = 3
Then a = (n+2)! + 2
a = 5! + 2
a + 1 = 5! + 3
a + 2 = 5! + 4
Here a is divisible by 2
Here a + 1 is divisible by 3
Here a + 2 is divisible by 4
Hence a, a+1, a+2 are all composites
2

Input : 3
Output : [122, 124]
Explanation 122, 123, 124 are all composite numbers
4

Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
41

[122, 124]
1

Let the length of range be n and range starts 
from a then, a, a+1, a+2, ...., a+n-1 all should 
be composite. So the problem boils down to finding
such 'a'.

If we closely observe p! (where p is a positive 
integers) then we will find that, p! has factors of
2, 3, 4, ..., p-1,
Hence if we add i to p! such that 1 < i < p,
then p! + i has a factor i, so p! + i must be 
composite. So we end up finding p! + 2, p! + 3,
 .... p! + p-1 are all composite and continuous 
integers forming a range [p! + 2, p! + p-1]
The above range consists of p-2 elements.
For a range of n elements we need to consider (n+2)!

If we take a = (n+2)! + 2, 
Then, a + 1 = (n+2)! + 3
Then, a + 2 = (n+2)! + 4
...
Then, a + n-1 = (n+2)! + n+1
Hence,
a = (n+2)! + 2 = 2*3*....*(n+2) + 2
a has 2 as its divisor because (n+2)! and 2 
both divides 2
a + 1 = 2*3*....*(n+2) + 3
a + 1 has 3 as its divisor because (n+2)! 
and 3 both divides 3
...
a + n-1 = 2*3*....*(n+2) + n+1
a + n-1 has n+1 as its divisor because (n+2)! 
and n+1 both divides n+1

Therefore range will be [ (n+2)! + 2, ( (n+2)! + 2 ) + n-1]
43

Java 

[122, 124]

[122, 124]
6
[122, 124]
7
 
Time Complexity : O(n) 
Auxiliary Space : O(1)

M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
5#include <bits/stdc++.h>0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0 #include <bits/stdc++.h>2
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
0
M = int(input())
N = int(input())

for number in range(M,N+1):
    count = 0
    #divisor search, do not count the number itself and 1
    for divider in range(2,number//2+1):
        if number%divider == 0:
            count+=1
    if count >= 1:
        print(number)
3Pratik Chhajer. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to . See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
 


Làm thế nào để bạn tìm thấy một số tổng hợp trong Python?

Cách tiếp cận :..
Đọc số đầu vào bằng đầu vào () hoặc raw_input () ..
Kiểm tra xem Num có lớn hơn 1 ..
Tìm các yếu tố. Chạy A cho vòng lặp từ 2 đến số được nhập. ....
Nếu số được nhập là 0 hoặc 1, chúng tôi nói rằng số không phải là số nguyên tố cũng như số tổng hợp ..
Tất cả các số khác là số tổng hợp ..
In kết quả ..

Làm thế nào để bạn tìm thấy phạm vi của một số nguyên tố trong Python?

Bước 1: Vòng lặp qua tất cả các yếu tố trong phạm vi đã cho.Bước 2: Kiểm tra từng số nếu nó có bất kỳ yếu tố nào giữa 1 và chính nó.Bước 3: Nếu có, thì số không phải là số nguyên tố và nó sẽ chuyển sang số tiếp theo.Bước 4: Nếu không, đó là số chính và chương trình sẽ in nó và kiểm tra số tiếp theo.

Làm thế nào để bạn kiểm tra một số là số nguyên tố hoặc tổng hợp trong Python?

Kiểm tra xem một số là số nguyên tố hoặc không sử dụng sqrt () từ nhập khẩu math+ 1): if (n % k == 0): flag = 1 break if (flag == 0): print (n, "là số nguyên tố!")!!using sqrt() from math import sqrt # Number to be checked for prime n = 9 flag = 0 if(n > 1): for k in range(2, int(sqrt(n)) + 1): if (n % k == 0): flag = 1 break if (flag == 0): print(n," is a Prime Number! ") else: print(n," is Not a Prime Number!

Làm thế nào để bạn tìm thấy một số tổng hợp giữa hai số?

Trong toán học, số tổng hợp là các số có nhiều hơn hai yếu tố ...
Tìm tất cả các yếu tố của số nguyên dương ..
Một số được cho là Prime nếu nó chỉ có hai yếu tố, 1 và chính nó ..
Nếu số có nhiều hơn hai yếu tố, thì đó là một tổng hợp ..