[go: up one dir, main page]

login
A145653
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.
1
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, 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, 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
OFFSET
1,4
LINKS
EXAMPLE
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.
MATHEMATICA
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 *)
CROSSREFS
Sequence in context: A164886 A091935 A086063 * A346153 A266119 A026263
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Oct 15 2008
EXTENSIONS
Extended by Ray Chandler, Oct 27 2008
STATUS
approved