This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A091936 #20 Jul 29 2023 06:39:59 %S A091936 2,5,11,17,37,67,131,257,521,1033,2053,4099,8209,16417,32771,65537, %T A091936 133121,262147,524353,1048609,2097169,4194433,8388617,16777729, %U A091936 33554467,67239937,134250497,268435459,536903681,1073741827,2147483713 %N A091936 Smallest prime between 2^n and 2^(n+1), having a minimal number of 1's in binary representation. %C A091936 A091935(n) = A000120(a(n)). %C A091936 So far only a(25) and a(32) possess 4 1's in their binary representation. %H A091936 Chai Wah Wu, <a href="/A091936/b091936.txt">Table of n, a(n) for n = 1..1000</a> %t A091936 NextPrim[ n_] := Block[ {k = n + 1}, While[ !PrimeQ[ k], k++ ]; k]; p = 2; Do[ c = Infinity; While[ p < 2^n, b = Count[ IntegerDigits[ p, 2], 1]; If[ c > b, c = b; q = p]; p = NextPrim[ p]; If[ c < 4, p = NextPrim[ 2^n]; Continue[ ]]]; Print[ q], {n, 2, 32}] (* _Robert G. Wilson v_, Feb 18 2004 *) %t A091936 b[ n_ ] := Min[ Select[ FromDigits[ #, 2 ] & /@ (Join[ {1}, #, {1} ] & /@ Permutations[ Join[ {1}, Table[ 0, {n - 2} ] ] ]), PrimeQ[ # ] & ] ]; c[ n_ ] := Min[ Select[ FromDigits[ #, 2 ] & /@ (Join[ {1}, #, {1} ] & /@ Permutations[ Join[ {1, 1}, Table[ 0, {n - 3} ] ] ]), PrimeQ[ # ] & ] ]; f[ n_ ] := If[ PrimeQ[ 2^n + 1 ], 2^n + 1, If[ PrimeQ[ b[ n ] ], b[ n ], c[ n ] ] ]; Table[ f[ n ], {n, 2, 32} ] (* _Robert G. Wilson v_ *) %o A091936 (Python) %o A091936 from sympy import isprime %o A091936 from sympy.utilities.iterables import multiset_permutations %o A091936 def A091936(n): %o A091936 for i in range(n+1): %o A091936 q = 2**n %o A091936 for d in multiset_permutations('0'*(n-i)+'1'*i): %o A091936 p = q+int(''.join(d),2) %o A091936 if isprime(p): %o A091936 return p # _Chai Wah Wu_, Apr 08 2020 %Y A091936 Cf. A091938, A019434. %K A091936 nonn %O A091936 1,1 %A A091936 _Reinhard Zumkeller_, Feb 14 2004 %E A091936 More terms from _Robert G. Wilson v_, Feb 18 2004