%I #22 Aug 28 2023 11:55:41
%S 2,3,1,0,2,2,1,0,0,4,1,0,2,5,1,0,1,0,1,0,2,2,1,0,0,1,0,0,2,4,1,0,2,4,
%T 1,0,2,3,1,0,2,2,1,0,0,2,1,0,0,0,1,0,1,0,1,0,2,6,1,0,2,1,0,0,2,4,1,0,
%U 2,8,1,0,2,1,0,0,2,2,1,0,0,18,1,0,2,5,1,0,1,0,1,0,2,5,1,0,1,0,0,0
%N a(n) is the least k such that 2^k + n is not squarefree.
%C a(n) = 0 if n + 1 is not squarefree.
%C a(n) <= 2 if n is even.
%C a(n) <= 6 if n is not divisible by 3.
%C a(n) <= 20 if n is not divisible by 5.
%H Robert Israel, <a href="/A365196/b365196.txt">Table of n, a(n) for n = 0..10000</a>
%e a(4) = 2 because 2^2 + 4 = 8 = 2^3 is not squarefree, while 2^0 + 4 = 5 and 2^1 + 4 = 6 are squarefree.
%p f:= proc(k) local j;
%p for j from 0 to 300 do if not numtheory:-issqrfree(2^j+k) then return j fi
%p od;
%p FAIL
%p end proc:
%p map(f, [$0..100]);
%o (PARI) a(n) = my(k=0); while (issquarefree(2^k+n), k++); k; \\ _Michel Marcus_, Aug 27 2023
%o (Python)
%o from itertools import count
%o from sympy import factorint
%o def A365196(n): return next(k for k in count(0) if max(factorint((1<<k)+n).values(),default=0)>1) # _Chai Wah Wu_, Aug 28 2023
%Y Cf. A005117.
%K nonn
%O 0,1
%A _Robert Israel_, Aug 25 2023