OFFSET
1,3
COMMENTS
The maximum term in the sequence is 123456789987654321, if leading zeros are not allowed.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..1023
EXAMPLE
121 and 1221 are legal terms but 122221 is not, since the digits 2,2 at positions 2 and 3 are not increasing.
PROG
(Perl)
#!/usr/bin/perl
open(OUT, ">incrDecrPalindrome.txt")||die "open fail OUT\n";
foreach $cand (0..100000){
@a=split("", $cand);
$b = join("", reverse @a);
next unless $cand==$b; # palindromes only
$n = int(@a/2.);
$n-- if &is_even(0+@a); # backoff if even count of digits
foreach $i (1..$n){
goto skip_num unless $a[$i-1] < $a[$i];
}
print OUT "$cand, ";
skip_num:;
print "";
}
print OUT "\n";
##########################################
sub is_even{ $_[0]/2. == int $_[0]/2. }
##########################################
(Python)
from itertools import combinations
A343524_list = [0]
for l in range(1, 4):
for d in combinations('123456789', l):
s = ''.join(d)
A343524_list.append(int(s+s[-2::-1]))
for d in combinations('123456789', l):
s = ''.join(d)
A343524_list.append(int(s+s[::-1])) # Chai Wah Wu, Apr 24 2021
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
James S. DeArmon, Apr 18 2021
EXTENSIONS
Terms < 100 prepended by Rémy Sigrist, Apr 25 2021
STATUS
approved