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.

A099280 2^n-th palindromic number.

This page as a plain text file.
%I A099280 #9 Jun 14 2024 01:49:06
%S A099280 1,2,4,8,77,232,555,2992,15751,41314,92529,1049401,3097903,7193917,
%T A099280 63855836,227696722,555373555,3107337013,16214541261,42428982424,
%U A099280 94857775849,1097153517901,3194305034913,7388609068837,67772177127776
%N A099280 2^n-th palindromic number.
%H A099280 Chai Wah Wu, <a href="/A099280/b099280.txt">Table of n, a(n) for n = 0..1661</a>
%t A099280 NextPalindrome[n_] := Block[ {l = Floor[ Log[10, n] + 1], idn = IntegerDigits[n]}, If[ Union[ idn] == {9}, Return[n + 2], If[l < 2, Return[n + 1], If[ FromDigits[ Reverse[ Take[ idn, Ceiling[l/2]]]] FromDigits[ Take[ idn, -Ceiling[l/2]]], FromDigits[ Join[ Take[ idn, Ceiling[l/2]], Reverse[ Take[ idn, Floor[l/2]]] ]], idfhn = FromDigits[ Take[ idn, Ceiling[l/2]]] + 1; idp = FromDigits[ Join[ IntegerDigits[ idfhn], Drop[ Reverse[ IntegerDigits[ idfhn]], Mod[l, 2]]]] ]]]]; k = 1; np = 0; Do[ While[np = NextPalindrome[np]; k != 2^n, k++ ]; Print[np], {n, 26}]
%o A099280 (Python)
%o A099280 def A099280(n):
%o A099280     if n == 0: return 1
%o A099280     m = 1<<n-1
%o A099280     k = (m<<1)+1
%o A099280     y = 10*(x:=10**(len(str(m))-1))
%o A099280     return (c:=k-x)*x+int(str(c)[-2::-1]or 0) if k<x+y else (c:=k-y)*y+int(str(c)[-1::-1]or 0) # _Chai Wah Wu_, Jun 13 2024
%Y A099280 Cf. A083816.
%K A099280 base,nonn
%O A099280 0,2
%A A099280 _Robert G. Wilson v_, Oct 04 2004