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 A276417 #24 Sep 08 2022 08:46:17 %S A276417 0,0,1,1,1,2,1,1,2,1,1,2,1,2,4,1,1,2,3,1,2,1,1,2,1,2,4,1,2,4,1,1,2,3, %T A276417 1,2,1,1,2,3,1,2,1,2,4,1,2,4,3,1,2,1,1,2,1,1,2,1,2,4,3,4,4,0,1,2,1,2, %U A276417 6,1,1,2,3,3,0,1,1,2,3,1,2,5,1,2,1,2,4 %N A276417 a(n) = least positive k such that (2*n + 1) - 2^k is prime, or 0 if no such k exists. %C A276417 a(n) = 1 iff n is in A006254. - _Robert Israel_, Sep 02 2016 %C A276417 For n > 1, a(n) = 0 iff 2n+1 is de Polignac number, A006285. - _Thomas Ordowski_, Apr 13 2017 %H A276417 Robert Israel, <a href="/A276417/b276417.txt">Table of n, a(n) for n = 0..10000</a> %F A276417 If A188903(n) >= 2, then a(n) = log_2(A188903(n)), otherwise a(n) = 0. %e A276417 a(14) = 4 because (2*14 + 1) - 2^k is composite for k = 1, 2, 3 and prime for k = 4. %p A276417 f:= proc(n) local k; %p A276417 for k from 1 do %p A276417 if 2*n < 2^k then return 0 %p A276417 elif isprime(2*n+1-2^k) then return k %p A276417 fi %p A276417 od %p A276417 end proc: %p A276417 map(f, [$0..100]); # _Robert Israel_, Sep 02 2016 %t A276417 Table[If[n <= 2, 0, k = 1; While[! PrimeQ[2 n + 1 - 2^k], k++]; k], {n, 0, 120}] (* _Michael De Vlieger_, Sep 03 2016 *) %o A276417 (Magma) lst:=[]; for n in [1..173 by 2] do k:=0; c:=k; repeat k+:=1; c+:=1; a:=n-2^k; until a lt 1 or IsPrime(a); if a lt 1 then Append(~lst, 0); else Append(~lst, c); end if; end for; lst; %o A276417 (PARI) a(n) = my(k=1); while(2^k < 2*n+1, if(ispseudoprime((2*n+1)-2^k), return(k)); k++); return(0) \\ _Felix Fröhlich_, Sep 02 2016 %Y A276417 Cf. A006254, A006285, A101036, A133122, A188903, A232460, A252168. %K A276417 nonn %O A276417 0,6 %A A276417 _Arkadiusz Wesolowski_, Sep 02 2016