|
| |
|
|
A050430
|
|
Length of longest palindromic subword of (n base 2).
|
|
8
| |
|
|
1, 1, 2, 2, 3, 2, 3, 3, 4, 3, 3, 2, 3, 3, 4, 4, 5, 4, 4, 3, 5, 4, 3, 3, 4, 3, 5, 3, 3, 4, 5, 5, 6, 5, 5, 5, 4, 4, 4, 3, 4, 5, 5, 4, 6, 5, 4, 4, 5, 4, 6, 3, 5, 5, 5, 3, 4, 3, 5, 4, 4, 5, 6, 6, 7, 6, 6, 5, 5, 5, 5, 5, 7, 5, 4, 6, 4, 5, 4, 4, 5, 6, 4, 5, 7, 5, 5, 4, 4, 6, 6, 5, 7, 6, 5, 5, 6, 5, 7, 5, 4, 6, 6, 3, 4
(list; graph; refs; listen; history; internal format)
|
|
|
|
OFFSET
| 1,3
|
|
|
COMMENTS
| a(A083318(n-1)) = n; a(A193159(k)) = 3, 1 <= k <= 26. [Reinhard Zumkeller, Jul 17 2011]
|
|
|
LINKS
| Reinhard Zumkeller, Table of n, a(n) for n = 1..16385 = 2^14 + 1
|
|
|
FORMULA
| a(n) <= min(a(2*n), a(2*n+1)). [Reinhard Zumkeller, Jul 31 2011]
|
|
|
EXAMPLE
| (11 base 2) = 1011, containing 101, therefore a(11) = 3.
|
|
|
MATHEMATICA
| f[n_] := Block[{id = IntegerDigits[n, 2]}, k = Length@ id; While[ Union[# == Reverse@# & /@ Partition[id, k, 1]][[-1]] != True, k--]; k]; Array[f, 105] (* Robert G. Wilson v, Jul 16 2011 *)
|
|
|
PROG
| (Haskell)
import Data.Char (intToDigit, digitToInt)
import Numeric (showIntAtBase)
a050430 n = a050430_list !! (n-1)
a050430_list = f 1 where
f n = g (showIntAtBase 2 intToDigit n "") : f (n+1)
g zs | zs == reverse zs = length zs
| otherwise = max (h $ init zs) (h $ tail zs)
h zs@('0':_) = g zs
h zs@('1':_) = a050430 $ foldl (\v d -> digitToInt d + 2*v) 0 zs
-- Reinhard Zumkeller, Jul 16 2011
|
|
|
CROSSREFS
| Cf. A007088; A050431 (base 3), A050432 (base 4), A050433 (base 5).
Sequence in context: A063787 A182745 A129843 * A071330 A092333 A107452
Adjacent sequences: A050427 A050428 A050429 * A050431 A050432 A050433
|
|
|
KEYWORD
| nonn,base
|
|
|
AUTHOR
| Clark Kimberling (ck6(AT)evansville.edu)
|
|
|
EXTENSIONS
| Extended by Ray Chandler (rayjchandler(AT)sbcglobal.net), Mar 11 2010
|
| |
|
|