Is it a Proth number?
Python, 22 bytes
lambda N:N-1&1-N>N**.5
This is a port of my Jelly answer. Test it on Ideone.
How it works
Let j be a strictly positive integer. j + 1 toggles all trailing set bits of j and the adjacent unset bit. For example, 100112 + 1 = 101002.
Since ~j = -(j + 1) = -j - 1, -j = ~j + 1, so -n applies the above to the bitwise NOT of j (which toggles all bits), thus toggling all bits before the last 1.
By taking j & -j – the bitwise AND of j and -j – all bits before and after the last set bit are nullified (since unequal in j and -j), thus yielding the highest power of 2 that divides j evenly.
For input N, we want to apply the above to N - 1 to find 2n, the highest power of 2 that divides N - 1. If m = N - 1, -m = -(N - 1) = 1 - N, so (N - 1) & (1 - N) yields 2n.
All that's left to test is if 2n > k. If k > 0, this is true if and only if (2n)2 > k2n, which is true itself if and only if (2n)2 ≥ k2n + 1 = N.
Finally, if (2n)2 = N = k2n + 1, 2n must be odd (1) so the parities of both sides can match, implying that k = 0 and N = 1. In this case (N - 1) & (1 - N) = 0 & 0 = 0 and ((N - 1) & (1 - N))2 = 0 < 1 = N.
Therefore, ((N - 1) & (1 - N))2 > N is true if and only if N is a Proth number.
Ignoring floating point inaccuracies, this is equivalent to the code N-1&1-N>N**.5
in the implementation.
Jelly, 5 bytes
’&C²>
Try it online! or verify all test cases.
Background
Let j be a strictly positive integer. j + 1 toggles all trailing set bits of j and the adjacent unset bit. For example, 100112 + 1 = 101002.
Since ~j = -(j + 1) = -j - 1, -j = ~j + 1, so -n applies the above to the bitwise NOT of j (which toggles all bits), thus toggling all bits before the last 1.
By taking j & -j – the bitwise AND of j and -j – all bits before and after the last set bit are nullified (since unequal in j and -j), thus yielding the highest power of 2 that divides j evenly.
For input N, we want to apply the above to N - 1 to find 2n, the highest power of 2 that divides N - 1. If m = N - 1, -m = -(N - 1) = 1 - N, so (N - 1) & (1 - N) yields 2n.
All that's left to test is if 2n > k. If k > 0, this is true if and only if (2n)2 > k2n, which is true itself if and only if (2n)2 ≥ k2n + 1 = N.
Finally, if (2n)2 = N = k2n + 1, 2n must be odd (1) so the parities of both sides can match, implying that k = 0 and N = 1. In this case (N - 1) & (1 - N) = 0 & 0 = 0 and ((N - 1) & (1 - N))2 = 0 < 1 = N.
Therefore, ((N - 1) & (1 - N))2 > N is true if and only if N is a Proth number.
How it works
’&C²> Main link. Argument: N
’ Decrement; yield N - 1.
C Complement; yield 1 - N.
& Take the bitwise AND of both results.
² Square the bitwise AND.
> Compare the square to N.
Mathematica, 50 48 45 40 38 35 31 29 bytes
Mathematica generally sucks when it comes to code golf, but sometimes there's a built-in that makes things look really nice.
1<#<4^IntegerExponent[#-1,2]&
A test:
Reap[Do[If[f[i],Sow[i]],{i,1,1000}]][[2,1]]
{3, 5, 9, 13, 17, 25, 33, 41, 49, 57, 65, 81, 97, 113, 129, 145, 161, 177, 193, 209, 225, 241, 257, 289, 321, 353, 385, 417, 449, 481, 513, 545, 577, 609, 641, 673, 705, 737, 769, 801, 833, 865, 897, 929, 961, 993}
Edit: Actually, if I steal Dennis's bitwise AND idea, I can get it down to 23 22 20 bytes.
Mathematica, 23 22 20 bytes (thanks A Simmons)
BitAnd[#-1,1-#]^2>#&