cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A052059 Least k such that the longest palindromic substring (without leading zeros) contained in 2^k has length n.

This page as a plain text file.
%I A052059 #18 Nov 12 2021 12:15:50
%S A052059 0,16,17,47,49,41,146,274,76,468,1622,4381,2961,12799,4292,28493,
%T A052059 34597,16276
%N A052059 Least k such that the longest palindromic substring (without leading zeros) contained in 2^k has length n.
%C A052059 a(12) > 3000. - _Erich Friedman_, Feb 19 2000
%C A052059 a(16) > 15000. - _Sean A. Irvine_, Oct 19 2021
%C A052059 No other terms <= 35000. - _Michael S. Branicky_, Nov 12 2021
%e A052059 a(3) = 17 since 2^17 = {131}072.
%o A052059 (Python)
%o A052059 def ispal(s): return s == s[::-1]
%o A052059 def longestpalss(n):
%o A052059     s = str(n)
%o A052059     for l in range(len(s), 0, -1):
%o A052059         for offset in range(len(s)-l+1):
%o A052059             if s[offset] != '0' and ispal(s[offset:offset+l]):
%o A052059                 return l
%o A052059 def a(n):
%o A052059     k, pow2 = 0, 1
%o A052059     while longestpalss(pow2) != n: k += 1; pow2 <<= 1
%o A052059     return k
%o A052059 print([a(n) for n in range(1, 11)]) # _Michael S. Branicky_, Nov 12 2021
%Y A052059 Cf. A052058, A052057.
%K A052059 nonn,base,hard,more
%O A052059 1,2
%A A052059 _Patrick De Geest_, Jan 15 2000
%E A052059 a(11)=1445 from _Erich Friedman_, Feb 19 2000
%E A052059 Title clarified, a(11) corrected, and a(12)-a(15) from _Sean A. Irvine_, Oct 19 2021
%E A052059 a(16)-a(18) from _Michael S. Branicky_, Nov 12 2021