Talk:Prime triangle: Difference between revisions
Content added Content deleted
(An Observation) |
(Yes.) |
||
Line 1: | Line 1: | ||
==An Observation== |
==An Observation== |
||
It may help some of the entries to note that primes greater than 2 are odd, and 1+1 is not valid, which implies that if you are looking for n+g=prime if a is even g must be odd and vv.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 10:44, 20 April 2022 (UTC) |
It may help some of the entries to note that primes greater than 2 are odd, and 1+1 is not valid, which implies that if you are looking for n+g=prime if a is even g must be odd and vv.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 10:44, 20 April 2022 (UTC) |
||
: Yes. ... I can get a 30% speedup on the C implementation by changing <tt>for (size_t i = 1; i + 1 != length; ++i) {</tt> to <tt>for (size_t i = 1; i + 1 < length; i+= 2) {</tt>. |
|||
: But I am leaving that alone for now -- this little laptop I am working on is so slow that the timings I would report would look like a significant slowdown even after that speedup (for me it's 1.64 seconds down to 1.25 seconds, and the code reports how long it takes to run). |
|||
: Also, I would have to update my attribution comment on my J entry... --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 15:55, 21 April 2022 (UTC) |
Revision as of 15:56, 21 April 2022
An Observation
It may help some of the entries to note that primes greater than 2 are odd, and 1+1 is not valid, which implies that if you are looking for n+g=prime if a is even g must be odd and vv.--Nigel Galloway (talk) 10:44, 20 April 2022 (UTC)
- Yes. ... I can get a 30% speedup on the C implementation by changing for (size_t i = 1; i + 1 != length; ++i) { to for (size_t i = 1; i + 1 < length; i+= 2) {.
- But I am leaving that alone for now -- this little laptop I am working on is so slow that the timings I would report would look like a significant slowdown even after that speedup (for me it's 1.64 seconds down to 1.25 seconds, and the code reports how long it takes to run).