cp's OEIS Frontend

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.

A059959 Distance of 2^n from its nearest prime neighbor and in case of a tie, choose the smaller.

This page as a plain text file.
%I A059959 #25 Jan 13 2024 10:47:39
%S A059959 -1,0,1,1,-1,1,3,1,-1,3,3,-5,3,1,3,-3,-1,1,-3,1,3,9,3,-9,3,-35,5,-29,
%T A059959 -3,3,-3,1,5,9,-25,31,5,-9,-7,7,-15,21,11,-29,-7,55,-15,-5,-21,-69,27,
%U A059959 -21,-21,-5,33,-3,5,-9,27,55,-33,1,57,25,-13,49,5,-3,23,19,-25,-11,-15,-29,35,-33,15,-11,-7,-23,-13,-17,-9,55,-3,19
%N A059959 Distance of 2^n from its nearest prime neighbor and in case of a tie, choose the smaller.
%H A059959 Robert G. Wilson v, <a href="/A059959/b059959.txt">Table of n, a(n) for n = 0..10000</a> (terms 0-4500 from Giovanni Resta)
%F A059959 a(n) = A000079(n) - A117387(n).
%e A059959 n=19, 2^19=524288, prevprime(524288)=524287, nextprime(524288)=524309, so min{21,1}=1=a(19).
%p A059959 with(numtheory): [seq(min(nextprime(2^i)-2^i, 2^i-prevprime(2^i)), i=2..100)];
%t A059959 f[n_] := Block[{k = 0}, While[ !PrimeQ[2^n -k] && !PrimeQ[2^n +k], k++]; If[ PrimeQ[2^n -k], k, -k]]; Array[f, 70, 0] (* _Robert G. Wilson v_, Mar 14 2006 and modified Jan 12 2024 *)
%Y A059959 Cf. A000079, A117387, A013597, A013603, A014210, A014234, A058249.
%K A059959 sign
%O A059959 0,7
%A A059959 _Labos Elemer_, Mar 02 2001
%E A059959 Signs added by _Robert G. Wilson v_, Mar 14 2006