login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Least k >= 0 such that 2n+1 - 2^k is a prime power, or -1 if no such k exists.
0

%I #9 Nov 21 2014 01:44:00

%S -1,0,0,1,0,1,1,1,0,1,1,2,1,1,1,1,0,2,3,1,2,1,1,2,1,1,2,1,2,4,1,1,0,3,

%T 1,2,1,1,2,3,1,1,1,2,3,1,2,4,3,1,2,1,1,2,1,1,2,1,2,4,3,1,2,1,0,2,1,2,

%U 4,1,1,2,3,3,-1,1,1,2,3,1,2,5,1,2,1,1,2,1,2,4,1,1,2,3,3,6,1,1,2,1,1,2,3,3,4,5,1,2,7,3,6,5,1,2,1,1,2,1,2,4,1,1,1,2,3,3,1,2,0,1,2

%N Least k >= 0 such that 2n+1 - 2^k is a prime power, or -1 if no such k exists.

%C It seems to make no difference whether one requires a prime power > 1 or a prime power including 1.

%C While such k >= 0 exists for most odd numbers 2n+1, there are only very few even numbers of this form.

%o (PARI) a(n)=for(k=0,log(n=n*2+1)\log(2)+1,(/*n-2^k==1 ||*/ isprimepower(n-2^k))&&return(k));-1

%Y Cf. A000079, A000961.

%K sign

%O 0,12

%A _M. F. Hasler_, Nov 20 2014