# Proving the following false: $f(x)=2x+1$ produces a prime number if and only if x is prime

$f(x)=2x+1$ produces a prime number if and only if x is prime, how can we prove this false?

I know this isn't very math-proofy, but can't we just plug in a number we know that is prime, i.e. $x=7$, and observe $f(7)=15$, which is not prime?

I'm intersting in writing a math proof for this, but I'm not exactly sure if my "proof" is good enough/proper. How should I do this?

• Even each of the implications is false. – Did Dec 26 '14 at 22:50
• That is enough to disprove the if and only if assertion, and it is mathy enough. Note that the other direction can also be disproved, for $19$ is prime but $9$ is not. – André Nicolas Dec 26 '14 at 22:53
• Let $p(x)$ be the proposition "$x$" is prime. Your statement is equivalent to writing: $\forall x: p(x)\leftrightarrow p(2x+1)$. To disprove it, show that $\exists x:(p(x)\wedge \neg p(2x+1))\vee (\neg p(x)\wedge p(2x+1))$, which is precisely what you have done. – Edward Jiang Dec 26 '14 at 22:53
• I believe that 6 -> 13 is the lowest counterexample (unless you count 1 -> 3, since 1 is not prime). – Scott Dec 26 '14 at 22:59

To prove a statement false, all you ever need to do is exhibit a counterexample. Your counterexample $x=7$ demonstrates that (one implication direction of) the proposition is not true for some $x$, and hence it can never be true for every $x$. So yes, your proof is perfectly "math-proofy" enough.

Your counterexample proves that $2x+1$ need not be prime if $x$ is prime. That is the "if" part, and your counterexample contradicts it, and hence the whole statement.

You might want also to note that $2\cdot 6 +1=13$ is a counterexample to the "only if" part - in that $f(x)$ can be prime even if $x$ is not.

Let $\mathbb{P}$ denote the set of prime numbers.

We need to prove logical statement $A$:

$\neg\forall{x\in\mathbb{N}}:{2x+1}\in\mathbb{P}\iff{x}\in\mathbb{P}$

Or the equivalent logical statement $B$:

$\neg\forall{x\in\mathbb{N}}:({2x+1}\in\mathbb{P}\implies{x}\in\mathbb{P})\wedge({x}\in\mathbb{P}\implies{2x+1}\in\mathbb{P})$

Or the equivalent logical statement $C$:

$\exists{x\in\mathbb{N}}:\neg({2x+1}\in\mathbb{P}\implies{x}\in\mathbb{P})\vee\neg({x}\in\mathbb{P}\implies{2x+1}\in\mathbb{P})$

Or the equivalent logical statement $D$:

$\exists{x\in\mathbb{N}}:\neg[({2x+1}\not\in\mathbb{P})\vee({x}\in\mathbb{P})]\vee\neg[({x}\not\in\mathbb{P})\vee({2x+1}\in\mathbb{P})]$

Or the equivalent logical statement $E$:

$\exists{x\in\mathbb{N}}:[({2x+1}\in\mathbb{P})\wedge({x}\not\in\mathbb{P})]\vee[({x}\in\mathbb{P})\wedge({2x+1}\not\in\mathbb{P})]$

Finally, in order to prove $\exists{x}$, we only need to find such value of $x$:

$x=6\implies(2x+1\in\mathbb{P})\wedge(x\not\in\mathbb{P})\implies{E}\iff{D}\iff{C}\iff{B}\iff{A}$

• It is quite useless to overload things with symbols! – Pedro Tamaroff Dec 29 '14 at 18:41
• @PedroTamaroff: Thank you for the constructive comment. OP wrote "I'm interested in writing a math proof for this, but I'm not exactly sure if my proof is good enough/proper", so I wrote down the proof as "mathematically" as possible. Obviously, the question itself is easy to answer in a more "natural" way (several ways as a matter of fact), and OP appears to be well aware of that, but he or she is asking for a formal proof. So I answered accordingly. – barak manos Dec 29 '14 at 18:53
• I cannot find where the OP asks for a "formal" proof. One shouldn't confuse formality with rigour. One can be perfectly rigorous without being formal. Being formal is usually much more tortuous and sometimes less useful and iluminating than being rigorous. In particular, saying "$9$ is not prime, but $19=2\cdot 9+1$ is, and $7$ is prime, but $15=2\cdot 7+1$ isn't" is a perfectly valid and rigorous proof that neither $x$ being prime implies $2x+1$ being prime, nor $2x+1$ being prime implies $x$ being prime. – Pedro Tamaroff Dec 29 '14 at 18:57
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://math.stackexchange.com/questions/1081845/proving-the-following-false-fx-2x1-produces-a-prime-number-if-and-only-if", "fetch_time": 1568850400000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2019-39/segments/1568514573385.29/warc/CC-MAIN-20190918234431-20190919020431-00232.warc.gz", "warc_record_offset": 594412698, "warc_record_length": 33455, "token_count": 1311, "char_count": 3964, "score": 4.15625, "int_score": 4, "crawl": "CC-MAIN-2019-39", "snapshot_type": "latest", "language": "en", "language_score": 0.8450933694839478, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00013-of-00064.parquet"}