This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A177062 Length of the longest common substring in binary representations of n and n^2. 2
 1, 2, 1, 3, 2, 2, 2, 4, 3, 3, 2, 3, 3, 3, 3, 5, 4, 4, 4, 4, 3, 3, 2, 4, 4, 4, 5, 4, 4, 4, 4, 6, 5, 5, 4, 5, 4, 4, 4, 5, 6, 3, 3, 4, 4, 2, 3, 5, 5, 4, 4, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 6, 6, 5, 6, 5, 5, 5, 6, 5, 5, 5, 4, 4, 4, 4 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 LINKS Robert Israel, Table of n, a(n) for n = 1..10000 MAPLE f:= n -> length(StringTools:-LongestCommonSubString(convert(convert(n, binary), string), convert(convert(n^2, binary), string))): map(f, [\$ 1..100]); # Robert Israel, Sep 13 2016 MATHEMATICA longestRun[pairs_] := Split[pairs, Equal @@ #1 && Equal @@ #2 &] // Sort[#, Length[#1] < Length[#2] &] & // Last; a[n_] := (bits1 = IntegerDigits[n, 2]; bits2 = IntegerDigits[n^2, 2]; longestRun /@ ListConvolve[ Reverse[bits1], bits2, {1, -1}, -1, List, List] // Sort[#, Length[#1] < Length[#2] &] & // Last // Length); a /@ Range[79] (* Jean-François Alcover, Jun 05 2013 *) Table[Length[LongestCommonSubsequence[IntegerDigits[n^2, 2], IntegerDigits[n, 2]]], {n, 1, 100}] (* Vladimir Reshetnikov, Apr 26 2016 *) PROG (Haskell) import Data.List toBinary 0 = [] toBinary n = toBinary (n `div` 2) ++ [odd n] lcstr xs ys = maximum . concat \$ [f xs' ys | xs' <- tails xs] ++ [f xs ys' | ys' <- drop 1 \$ tails ys] where f xs ys = scanl g 0 \$ zip xs ys; g z (x, y) = if x == y then z + 1 else 0 a = [lcstr (toBinary \$ n) (toBinary \$ n^2) | n <- [1..]] CROSSREFS Cf. A276692 Sequence in context: A297167 A303389 A276166 * A133924 A023135 A191654 Adjacent sequences:  A177059 A177060 A177061 * A177063 A177064 A177065 KEYWORD base,easy,nonn AUTHOR Vladimir Reshetnikov, May 02 2010 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified October 15 13:36 EDT 2018. Contains 316236 sequences. (Running on oeis4.)