来自在线整数百科全书的问候语!http://oeis.org/ Search: id:a050430 Showing 1-1 of 1 %I A050430 %S A050430 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, %T A050430 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, %U A050430 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 %N A050430 Length of longest palindromic subword of (n base 2). %C A050430 a(A083318(n-1)) = n; a(A193159(k)) = 3, 1 <= k <= 26. 7月17日,2011岁的Reinhard Zumkellern,a(n)n=1…16385=2 ^ 14+1的表%f a050430a(n)<min(a(2×n),a(2×n+1))。[_Reinhard Zumkeller_, Jul 31 2011] %e A050430 (11 base 2) = 1011, containing the palindrome 101, therefore a(11) = 3. %p A050430 # A050430 Length of longest palindromic factor of n for n in [M1..M2] - from _N. J. A. Sloane_, Aug 07 2012, revised Aug 11 2012 %p A050430 isPal := proc(L) %p A050430 local d ; %p A050430 for d from 1 to nops(L)/2 do %p A050430 if op(d, L) <> op(-d, L) then %p A050430 return false; %p A050430 end if; %p A050430 end do: %p A050430 return true; %p A050430 end proc: %p A050430 # start of main program %p A050430 ans:=[]; %p A050430 M1:=0; M2:=64; %p A050430 for n from M1 to M2 do %p A050430 t1:=convert(n,base,2); %p A050430 rec:=0: %p A050430 l1:=nops(t1); %p A050430 for j1 from 0 to l1-1 do %p A050430 for j2 from j1+1 to l1 do %p A050430 F1 := [op(j1+1..j2,t1)]; %p A050430 if (isPal(F1) and j2-j1>rec) then rec:=j2-j1; fi; %p A050430 od: %p A050430 od: %p A050430 ans:=[op(ans),rec]: %p A050430 od: %p A050430 ans;[%%A050430F[n]:=块[{ID=整数数字[n,2 ] },k=长度@ id;同时[UNIO[O==Rewite]和[@分区[ID,K,1 ] ] [[-1 ] ]!=真,k-,k];数组[f,105 ](*-Orth-R.G.Wilson Vy,7月16日2011))%0A050430(Haskell)%O A050430导入数据。查尔(ItotoDigd,DigtoToT)%0A050430导入数值(StuttualBASE)%O O A050430 A050430 n=A050430A列表!! (n-1) %o A050430 a050430_list = f 1 where %o A050430 f n = g (showIntAtBase 2 intToDigit n "") : f (n+1) %o A050430 g zs | zs == reverse zs = length zs %o A050430 | otherwise = max (h $ init zs) (h $ tail zs) %o A050430 h zs@('0':_) = g zs %o A050430 h zs@('1':_) = a050430 $ foldl (\v d -> digitToInt d + 2*v) 0 zs %o A050430 -- _Reinhard Zumkeller_, Jul 16 2011 %Y A050430 Cf. A007088; A050431 (base 3), A050432 (base 4), A050433 (base 5). %Y A050430 Cf. A215244, A215467, A215256. %K A050430 nonn,base %O A050430 1,3 %A A050430 _Clark Kimberling_ %E A050430 Extended by _Ray Chandler_, Mar 11 2010 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE