I'm pretty new to python, and am playing around with codes for prime numbers, I created a function that tests the goldbach conjecture on any positive integer given, and returns False, 0, 0 if the conjecture does not apply, and returns True, p1, p2 if the given number follows the goldbach conjecture, for example, goldbach(10), would return True, 3, 7 or goldbach(21) would return True, 2, 19.
I also created a function that creates a list of prime numbers in a given range, is it possible to map my goldbach(n) function to this created list, so that it returns a new list containing something like [(bool, p1, p2), ..., (bool, p1, p2)]? If so, how would I go about coding this? Is the map() function even what I should be using? I believe I'm missing something important here, because I always get an error saying: 'tuple' object is not callable.
This is what is most likely causing the problem:
def goldbachlist(x):
primes=listofprimes(x)
gold=list(map(goldbach(x), primes))
return gold
mapmust be a function. Try:gold=list(map(goldback, primes)