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.

A333770 Smallest palindromic number >= 3^n.

This page as a plain text file.
%I A333770 #14 May 04 2020 13:08:53
%S A333770 1,3,9,33,88,252,737,2222,6666,19691,59095,177771,532235,1594951,
%T A333770 4783874,14355341,43055034,129141921,387424783,1162332611,3486886843,
%U A333770 10460406401,31381118313,94143234149,282429924282,847288882748
%N A333770 Smallest palindromic number >= 3^n.
%H A333770 Robert Israel, <a href="/A333770/b333770.txt">Table of n, a(n) for n = 0..2093</a>
%F A333770 a(n) = A262038(A000244(n)). - _Michel Marcus_, May 04 2020
%e A333770 a(10) = 59095, because 3^10 = 59049 and 59095 is the smallest palindromic number >= 59049.
%p A333770 digrev:= proc(n) local L,i;
%p A333770   L:= convert(n,base,10);
%p A333770   add(L[-i]*10^(i-1),i=1..nops(L))
%p A333770 end proc:
%p A333770 f:= proc(n) local d,x,y,t;
%p A333770   d:= ilog10(n)+1;
%p A333770   if d::even then
%p A333770     x:= floor(n/10^(d/2));
%p A333770     t:= x*10^(d/2)+digrev(x);
%p A333770     if t >= n then return t fi;
%p A333770     (x+1)*10^(d/2)+digrev(x+1);
%p A333770   else
%p A333770     x:= floor(n/10^((d-1)/2));
%p A333770     t:= x*10^((d-1)/2)+digrev(floor(x/10));
%p A333770     if t >= n then return t fi;
%p A333770     y:= x mod 10;
%p A333770     if y < 9 then return t + 10^((d-1)/2) fi;
%p A333770     x:= x+1;
%p A333770     x*10^((d-1)/2)+digrev(floor(x/10));
%p A333770   fi
%p A333770 end proc:
%p A333770 seq(f(3^i),i=0..30); # _Robert Israel_, May 04 2020
%o A333770 (PARI) a(n) = for(k=3^n, oo, if(Vecrev(v=digits(k))==v, return(k)));
%Y A333770 Cf. A000244, A002113, A262038, A333016.
%K A333770 easy,nonn,base
%O A333770 0,2
%A A333770 _Eder Vanzei_, Apr 04 2020