Free Republic
Browse · Search
General/Chat
Topics · Post Article

To: SeekAndFind

AI can’t program, PRODUCE or create new ideas.

It can deduce and regurgitate existing concepts and ideas but only what it’s seen.

If you need new concepts, new solutions (and you need that if you’re coding NEW programs) then you need real engineers.

AI might compete with low level “grunt” programming - but do that and you’ll knock out low level people who will never become advanced people.


9 posted on 03/16/2025 7:01:59 PM PDT by Skywise
[ Post Reply | Private Reply | To 1 | View Replies ]


To: Skywise

“AI can’t program, PRODUCE or create new ideas.”

‘Write a program for finding prime nujbers’

GEMINI

def is_prime(n):
“””Returns True if n is a prime number, False otherwise.”””
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True

def find_primes(limit):
“””Returns a list of prime numbers up to the given limit.”””
prime_numbers = []
for i in range(2, limit + 1):
if is_prime(i):
prime_numbers.append(i)
return prime_numbers

# Example usage: Find prime numbers up to 100
primes_up_to_100 = find_primes(100)
print(”Prime numbers up to 100:”, primes_up_to_100)

# Example usage: Find prime numbers up to 50
primes_up_to_50 = find_primes(50)
print(”Prime numbers up to 50:”, primes_up_to_50)

Explanation:
* is_prime(n) function:
* Takes an integer n as input.
* Returns False if n is less than or equal to 1 (because 1 and numbers less than 1 are not prime).
* Iterates from 2 up to the square root of n. If n is divisible by any number in this range, it’s not prime, and the function returns False.
* If the loop completes without finding a divisor, n is prime, and the function returns True.
* find_primes(limit) function:
* Takes an integer limit as input.
* Creates an empty list prime_numbers.
* Iterates from 2 up to limit.
* For each number, it calls the is_prime() function to check if it’s prime.
* If is_prime() returns True, the number is appended to the prime_numbers list.
* returns the list of prime numbers.
* Example Usage:
* The code demonstrates how to use the find_primes() function to find prime numbers up to 100 and 50.
* The results are printed to the console.


13 posted on 03/16/2025 7:06:14 PM PDT by TexasGator (X1.1111'1'./iI11 .I1.11.'1I1.I'')
[ Post Reply | Private Reply | To 9 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson