login
A261453
Near-repdigit palindromes with an odd number of digits and all digits except the middle digit equal.
1
101, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 454, 464, 474, 484, 494, 505, 515, 525, 535, 545, 565, 575, 585, 595, 606, 616, 626, 636, 646, 656, 676
OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..171 from R. J. Mathar)
FORMULA
a(n) = A002113(A210666(A001633(n))).
MAPLE
isA261453 := proc(n)
local ndgs, dgs, d ;
if isA002113(n) then
ndgs := A055642(n) ;
if type(ndgs, 'odd') and A043537(n) = 2 then
dgs := convert(n, base, 10) ;
for d from 2 to nops(dgs)/2 do
if op(d, dgs) <> op(d-1, dgs) then
return false;
end if;
end do:
true ;
else
false;
end if;
else
false;
end if;
end proc:
n := 1:
for i from 100 to 2000000 do
if isA261453(i) then
printf("%d %d\n", n, i) ;
n := n+1 ;
end if;
end do: # R. J. Mathar, Sep 30 2015
MATHEMATICA
id[n_]:=IntegerDigits[n]; len[n_]:=Length[id[n]];
del[n_]:=Delete[id[n], Ceiling[len[id[n]]/2]];
u[n_]:=Union[del[id[n]]];
Select[Range[10^5], StringMatchQ[ToString[#], a__~~b_~~a__]&&Length[u[#]]==1&&u[#]!= Union[id[#]]&] (* Ivan N. Ianakiev, Sep 06 2015 *)
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
for d in count(1):
for out in "123456789":
for mid in "0123456789":
if mid != out:
yield int(out*d + mid + out*d)
print(list(islice(agen(), 52))) # Michael S. Branicky, May 17 2022
(PARI) is_a002113(n) = my(d=digits(n)); d==Vecrev(d)
is_a210666(n) = my(d=digits(n)); #d>2 && (#setintersect(vecsort(d), vector(#d, x, vecmax(d)))==#d-1 || #setintersect(vecsort(d), vector(#d, x, vecmin(d)))==#d-1)
is_a001633(n) = #Str(n)%2 \\ after Charles R Greathouse IV in A001633
is(n) = is_a002113(n) && is_a210666(n) && is_a001633(n) \\ Felix Fröhlich, May 25 2022
CROSSREFS
Subsequence of A088882.
Sequence in context: A328996 A046075 A088882 * A135602 A095635 A060916
KEYWORD
nonn,base,easy
AUTHOR
Felix Fröhlich, Aug 25 2015
STATUS
approved