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
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
Sequence in context: A327808 A284964 A344247 * A281973 A219557 A094538
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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 15:20 EDT 2024. Contains 371916 sequences. (Running on oeis4.)