cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A343524 Palindromes with digits strictly increasing up to the middle digit.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 121, 131, 141, 151, 161, 171, 181, 191, 232, 242, 252, 262, 272, 282, 292, 343, 353, 363, 373, 383, 393, 454, 464, 474, 484, 494, 565, 575, 585, 595, 676, 686, 696, 787, 797, 898, 1221, 1331
Offset: 1

Views

Author

James S. DeArmon, Apr 18 2021

Keywords

Comments

The maximum term in the sequence is 123456789987654321, if leading zeros are not allowed.

Examples

			121 and 1221 are legal terms but 122221 is not, since the digits 2,2 at positions 2 and 3 are not increasing.
		

Crossrefs

Cf. A002113, A009993, A062351 (primes), A134941.

Programs

  • 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

Extensions

Terms < 100 prepended by Rémy Sigrist, Apr 25 2021