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.

A281571 Smallest k such that (the base-2 number formed by concatenating k consecutive base-2 numbers starting at n) is prime, or 0 if no such k exists.

This page as a plain text file.
%I A281571 #59 May 17 2017 13:47:51
%S A281571 15,1,1,2,1,26,1,2,31
%N A281571 Smallest k such that (the base-2 number formed by concatenating k consecutive base-2 numbers starting at n) is prime, or 0 if no such k exists.
%C A281571 The first primes reached are 485398038695407, 2, 3, 37, 5, 288368629084891241583296816292460511, 7, 137, 55212283888448697916635329662406145945631873447, ...
%C A281571 Except for the second term, n and a(n) have the same parity, i.e., a(n) == n (mod 2). Is it proved (or can it be disproved) that the required k exists for all n? a(10), a(21), a(24), a(38), a(52), a(55) are larger than 1500, if they exist. - _M. F. Hasler_, Apr 26 2017
%C A281571 a(10) > 40000. Terms at indices 24, 38, 55, 56, 57, 60, 62, 65, 66, 76, 78, 91, 92, 95 are > 20000. A large known term is a(330) = 9376. - _Hans Havermann_, May 17 2017
%H A281571 Paolo P. Lava, <a href="/A281571/a281571_1.txt">First 100 terms</a> (with -1 if a(n) is not presently known)
%F A281571 a(n) = 1 if n is prime.
%e A281571 a(1) = 15 because we have to concatenate the base-2 numbers from 1 to 15 to reach the first prime. In fact concat(1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111) =
%e A281571 1101110010111011110001001101010111100110111101111, which is prime (in base 10 it is 485398038695407).
%p A281571 P:=proc(q) local a,b,k,n; for n from 1 to q do
%p A281571 if isprime(n) then print(1); else a:=convert(n,binary,decimal);
%p A281571 for k from n+1 to q do b:=convert(k,binary,decimal); a:=a*10^(ilog10(b)+1)+b; if isprime(convert(a,decimal,binary))
%p A281571 then print(k-n+1); break; fi; od; fi; od; end: P(10^10);
%t A281571 With[{nn = 2^10}, Table[Module[{k = n, w = IntegerDigits[n, 2]}, While[And[! PrimeQ[FromDigits[w, 2]], k - n < nn], k++; w = Join[w, IntegerDigits[k, 2]]]; If[k - n >= nn, -1, k - n + 1]], {n, 50}]] (* _Michael De Vlieger_, Apr 26 2017, with -1 indicating values of k > limit nn *)
%o A281571 (PARI) a(n,c=1,m=n)=while(!ispseudoprime(n),c++;n=n<<#binary(m++)+m);c
%Y A281571 Cf. A000040, A047778.
%Y A281571 Cf. A244424 for the base-10 variant.
%K A281571 nonn,base,more
%O A281571 1,1
%A A281571 _Paolo P. Lava_, Jan 24 2017
%E A281571 Edited by _Max Alekseyev_, Apr 26 2017.
%E A281571 Further edits from _N. J. A. Sloane_, Apr 26 2017
%E A281571 a(18) = 586, a(28) = 934, a(35) = 947, a(51) = 1325 (PRP), and further edits from _M. F. Hasler_, Apr 26 2017