#!/usr/bin/env python3

import math, random

def is_prime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        if n % i == 0:
            return False
    return True

def generate_prime(k):
    low_lim = int(math.pow(10, k - 1))
    sup_lim = int(math.pow(10, k) - 1)
    
    while True:
        hope = int(random.randint(low_lim, sup_lim))
        if is_prime(hope):
            return hope

#number = input("Introduce un nr: ")
number = "1239123"
num = int(number)
print(str(num))
reversed = int(number[::-1])
print(reversed)

print("Generam un nr prim de 3 cifre")
print(generate_prime(15))