login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A333770 Smallest palindromic number >= 3^n. 2
1, 3, 9, 33, 88, 252, 737, 2222, 6666, 19691, 59095, 177771, 532235, 1594951, 4783874, 14355341, 43055034, 129141921, 387424783, 1162332611, 3486886843, 10460406401, 31381118313, 94143234149, 282429924282, 847288882748 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

LINKS

Robert Israel, Table of n, a(n) for n = 0..2093

FORMULA

a(n) = A262038(A000244(n)). - Michel Marcus, May 04 2020

EXAMPLE

a(10) = 59095, because 3^10 = 59049 and 59095 is the smallest palindromic number >= 59049.

MAPLE

digrev:= proc(n) local L, i;

  L:= convert(n, base, 10);

  add(L[-i]*10^(i-1), i=1..nops(L))

end proc:

f:= proc(n) local d, x, y, t;

  d:= ilog10(n)+1;

  if d::even then

    x:= floor(n/10^(d/2));

    t:= x*10^(d/2)+digrev(x);

    if t >= n then return t fi;

    (x+1)*10^(d/2)+digrev(x+1);

  else

    x:= floor(n/10^((d-1)/2));

    t:= x*10^((d-1)/2)+digrev(floor(x/10));

    if t >= n then return t fi;

    y:= x mod 10;

    if y < 9 then return t + 10^((d-1)/2) fi;

    x:= x+1;

    x*10^((d-1)/2)+digrev(floor(x/10));

  fi

end proc:

seq(f(3^i), i=0..30); # Robert Israel, May 04 2020

PROG

(PARI) a(n) = for(k=3^n, oo, if(Vecrev(v=digits(k))==v, return(k)));

CROSSREFS

Cf. A000244, A002113, A262038, A333016.

Sequence in context: A327808 A284964 A344247 * A281973 A219557 A094538

Adjacent sequences:  A333767 A333768 A333769 * A333771 A333772 A333773

KEYWORD

easy,nonn,base

AUTHOR

Eder Vanzei, Apr 04 2020

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 22 15:13 EST 2022. Contains 350481 sequences. (Running on oeis4.)