Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #39 Nov 30 2024 14:09:37
%S 101,121,131,141,151,161,171,181,191,202,212,232,242,252,262,272,282,
%T 292,303,313,323,343,353,363,373,383,393,404,414,424,434,454,464,474,
%U 484,494,505,515,525,535,545,565,575,585,595,606,616,626,636,646,656,676
%N Near-repdigit palindromes with an odd number of digits and all digits except the middle digit equal.
%H Michael S. Branicky, <a href="/A261453/b261453.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..171 from R. J. Mathar)
%F a(n) = A002113(A210666(A001633(n))).
%p isA261453 := proc(n)
%p local ndgs,dgs,d ;
%p if isA002113(n) then
%p ndgs := A055642(n) ;
%p if type(ndgs,'odd') and A043537(n) = 2 then
%p dgs := convert(n,base,10) ;
%p for d from 2 to nops(dgs)/2 do
%p if op(d,dgs) <> op(d-1,dgs) then
%p return false;
%p end if;
%p end do:
%p true ;
%p else
%p false;
%p end if;
%p else
%p false;
%p end if;
%p end proc:
%p n := 1:
%p for i from 100 to 2000000 do
%p if isA261453(i) then
%p printf("%d %d\n",n,i) ;
%p n := n+1 ;
%p end if;
%p end do: # _R. J. Mathar_, Sep 30 2015
%t id[n_]:=IntegerDigits[n];len[n_]:=Length[id[n]];
%t del[n_]:=Delete[id[n],Ceiling[len[id[n]]/2]];
%t u[n_]:=Union[del[id[n]]];
%t Select[Range[10^5],StringMatchQ[ToString[#],a__~~b_~~a__]&&Length[u[#]]==1&&u[#]!= Union[id[#]]&] (* _Ivan N. Ianakiev_, Sep 06 2015 *)
%t Select[Flatten[Table[FromDigits[Join[PadRight[{},n,rd],{k},PadRight[{},n,rd]]],{n,3},{rd,9},{k,0,9}]],Count[DigitCount[#],0]==8&] (* _Harvey P. Dale_, Nov 30 2024 *)
%o (Python)
%o from itertools import count, islice
%o def agen(): # generator of terms
%o for d in count(1):
%o for out in "123456789":
%o for mid in "0123456789":
%o if mid != out:
%o yield int(out*d + mid + out*d)
%o print(list(islice(agen(), 52))) # _Michael S. Branicky_, May 17 2022
%o (PARI) is_a002113(n) = my(d=digits(n)); d==Vecrev(d)
%o 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)
%o is_a001633(n) = #Str(n)%2 \\ after _Charles R Greathouse IV_ in A001633
%o is(n) = is_a002113(n) && is_a210666(n) && is_a001633(n) \\ _Felix Fröhlich_, May 25 2022
%Y Subsequence of A088882.
%Y Cf. A001633, A002113, A210666.
%K nonn,base,easy
%O 1,1
%A _Felix Fröhlich_, Aug 25 2015