Chain of primes

You have to program the function @has_prime_chain@ below. Remember that a non negative integer nn is prime if and only if nn is greater than one and the only divisors of nn are one and nn. The following auxiliar function may be helpful.

def is_prime(n):
    '''
    Requires a non negative integer n.
    Returns True when n is prime 
    Returns False when n is not prime
    '''
    if  n < 2:
        return False
    d = 2
    while d*d <= n:
        if n%d == 0:
            return False
        d += 1
    return True

Scoring

The function counts 100 points.

Sample session

Problem information

Author: ProAl

Generation: 2026-01-25T17:20:50.542Z

© Jutge.org, 2006–2026.
https://jutge.org