%I #8 Dec 09 2017 16:48:38
%S 1,1,1,2,3,2,3,3,3,3,1,4,4,4,3,4,5,2,5,3,4,5,4,4,4,5,3,4,3,3,2,4,6,5,
%T 6,4,4,5,4,5,5,4,2,5,6,4,4,3,5,4,5,4,5,2,6,6,7,4,5,7,3,4,6,5,6,4,5,5,
%U 6,4,6,5,5,5,6,3,5,5,5,4,6,5,4,6,6,4,5,6,7,5,5,4,5,5,6,7,2,8,5,5,6,5,6,8,4
%N a(n) = the length of the longest substring of digits that occurs both in the binary representation of the n-th prime and in the binary representation of the (n+1)th prime.
%H Harvey P. Dale, <a href="/A145653/b145653.txt">Table of n, a(n) for n = 1..1000</a>
%e The 12th prime is 37, which is 100101 in binary. The 13th prime is 41, which is 101001 in binary. The largest string of digits occurring in both binary representations is 1001, which occurs like so: (1001)01 and 10(1001). a(12) therefore equals 4 because 1001 contains 4 digits.
%t lsub[n_]:=Module[{p1=IntegerDigits[Prime[n],2],p2=IntegerDigits[ Prime[ n+1],2]}, Flatten[ Table[ Partition[p1,k,1],{k,Length[p1]}],1]]; Table[ Max[ Length/@Intersection[lsub[x],lsub[x+1]]],{x,120}] (* _Harvey P. Dale_, Dec 09 2017 *)
%K base,nonn
%O 1,4
%A _Leroy Quet_, Oct 15 2008
%E Extended by _Ray Chandler_, Oct 27 2008
|