def next_prime(starting_value):
 if (starting_value < 2):
  return 2
 result = ((starting_value + 1) | 1)
 while (not is_prime(result)):
  result = (result + 2)
 return result

def next_prime ( starting_value ) : if ( starting_value < 2 ) : return 2 result = ( ( starting_value + 1 ) | 1 ) while ( not is_prime ( result ) ) : result = ( result + 2 ) return result
return the smallest prime larger than the starting value .