# Create Predicate Function like PrimeQ :: fibonacciQ, pythgoreanQ

Yes, just define the function. i.e. Use the Fibonacci numbers. What are good practices to perform it? (Vague, let's get specific.)

1. Create list of Fib.s 0, to 1,000,000.
2. Make function _Integer parameter, name fibonacciQ.
3. Error trap with message if < 0, or > million.

Is that how, to do it? My real GOAL is any {x,y,z} of Pythagorean Triples (not {3,4,5}, or {3,10}, or {3,4,4,5} eg.), only one value tested per call, create a predicate function pythagoreanQ[ ] for them. Likely, load table from disk, when needed in a notebook. Is that my only practical alternative, unless computing pythags 3 .. 1,000,000 directly every time?

• fibQ = TrueQ[# == Fibonacci@Round[Log[GoldenRatio, Sqrt[5] #]]] &? pythagQ = TrueQ[#1^2 + #2^2 == #3^2] & or pythagQ = TrueQ[{1, 1, 1} . #^2 == 0] &? Commented Dec 8, 2021 at 4:04
• "not {3,4,5}, or {3,10}, or {3,4,4,5}" -- does that mean that pythagoreanQ[{3,4,5}] should return False? "Select[ {3,13, 100, 17} returns {True, True, True, True}" seems to make no sense since {3,13,100,17} is not a triple at all. Also Select[] is a built-in function that does not return a list of True unless the input contained True. Do you mean pQ[n] should return True if n is a member of any Pythagorean triple? Commented Dec 8, 2021 at 14:29
• Last part yes, "pQ[n] should return True if n is a member of any Pythagorean triple? pQ[x,y,z] is an invalid form, just as pQ[x,z] would be. ** A simple Select[ data, pQ[ #] &] is how it will be called. Commented Dec 8, 2021 at 16:46
• You should note that if $n$ is an integer greater than $2$, there always exist positive integers $x,y,z$ such that $x^2+y^2=z^2$ and $x=n$. Commented Dec 8, 2021 at 18:08

PythagoreanQ[{x_Integer, y_Integer, z_Integer}] :=