<prompt> Kujenga algorithm kwamba anarudi idadi zote wa kwanza hadi idadi fulani ya kuingia  <response>: Assuming the input is a positive integer n, here is an algorithm in python that returns all prime numbers up to n:pythonfrom math import sqrtdef primesn: if n 0 or n1: return Empty list since 0 and 1 are not primes else: initialize list of primes with 2, which is the first prime number primes_list 2 Check if subsequent integers until n are primes for num in range3,n1: initialize is_prime flag as true is_prime True check if number is divisible by any integer up to the integers square root for i in range2,intsqrtnum1: if numi 0: is_prime False break if is_prime flag is still true after the checking, add integer to the prime list if is_prime: primes_list.appendnum return primes_list 