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.

Showing 1-6 of 6 results.

A062352 Palindromic primes with strictly decreasing digits up to the middle and then strictly increasing.

Original entry on oeis.org

2, 3, 5, 7, 11, 101, 313, 727, 757, 919, 929, 31013, 73037, 73237, 74047, 76367, 91019, 93139, 93239, 94049, 94349, 96269, 96469, 97379, 97579, 98389, 98689, 7310137, 7521257, 7540457, 7630367, 7632367, 7654567, 9320239, 9610169
Offset: 1

Views

Author

Amarnath Murthy, Jun 23 2001

Keywords

Comments

The last term of this finite series is 97654321012345679.
There are 84 terms. - Michael S. Branicky, Aug 04 2022

Examples

			31013 belongs to the sequence as it is a palindromic prime in which the digits are decreasing up to the middle digit 0 and then increasing.
		

Crossrefs

Cf. A062351.

Programs

  • Python
    from sympy import isprime
    from itertools import combinations
    def bgen():
        for digits in range(1, 20):
            for left in combinations("9876543210", (digits+1)//2):
                left = "".join(left)
                yield int(left + (left[:digits//2])[::-1])
    afull = sorted(filter(isprime, bgen()))
    print(afull) # Michael S. Branicky, Aug 04 2022

Extensions

Corrected and edited by Patrick De Geest, Jun 07 2003

A084836 Palindromic primes with nondecreasing digits up to the middle and then nonincreasing.

Original entry on oeis.org

2, 3, 5, 7, 11, 131, 151, 181, 191, 353, 373, 383, 787, 797, 11311, 11411, 12421, 12721, 12821, 13331, 13831, 13931, 14741, 15551, 16661, 17971, 19991, 33533, 34543, 34843, 35753, 77977, 78887, 79997, 1114111, 1117111, 1123211, 1126211, 1129211, 1134311
Offset: 1

Views

Author

Patrick De Geest, Jun 07 2003

Keywords

Crossrefs

Programs

  • Python
    from sympy import isprime
    from itertools import count, islice, combinations_with_replacement as mc
    def agen():
        yield from (2, 3, 5, 7, 11)
        for d in count(2):
            ndni = (int("".join(m+m[:-1][::-1])) for m in mc("123456789", d))
            yield from filter(isprime, ndni)
    print(list(islice(agen(), 40))) # Michael S. Branicky, Jun 26 2022

Extensions

a(39) and beyond from Michael S. Branicky, Jun 26 2022

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

A084837 Palindromic primes with nonincreasing digits up to the middle and then nondecreasing.

Original entry on oeis.org

2, 3, 5, 7, 11, 101, 313, 727, 757, 919, 929, 31013, 72227, 73037, 73237, 74047, 75557, 76367, 76667, 77377, 77477, 91019, 93139, 93239, 94049, 94349, 96269, 96469, 97379, 97579, 98389, 98689, 3211123, 3222223, 3310133, 3321233, 3331333, 7100017, 7300037, 7310137
Offset: 1

Views

Author

Patrick De Geest, Jun 07 2003

Keywords

Crossrefs

Programs

  • Python
    from sympy import isprime
    from itertools import count, islice, combinations_with_replacement as mc
    def agen(): # generator of terms
        yield from (2, 3, 5, 7, 11)
        for d in count(2):
            nind = (int("".join(m+m[:-1][::-1])) for m in mc("9876543210", d))
            yield from sorted(filter(isprime, nind))
    print(list(islice(agen(), 40))) # Michael S. Branicky, Jun 26 2022

Extensions

a(38) and beyond from Michael S. Branicky, Jun 26 2022

A367735 Prime numbers wherein digit values increase, decrease, and finally increase.

Original entry on oeis.org

1201, 1213, 1217, 1301, 1303, 1307, 1319, 1327, 1409, 1423, 1427, 1429, 1439, 1523, 1549, 1601, 1607, 1609, 1613, 1619, 1627, 1637, 1657, 1709, 1723, 1747, 1759, 1801, 1823, 1847, 1867, 1879, 1901, 1907, 1913, 1949, 1979, 2309, 2417, 2423, 2437, 2503, 2539
Offset: 1

Views

Author

James S. DeArmon, Jan 24 2024

Keywords

Comments

Terms must have at least 4 digits.
There are 3287310 terms, with the last being 1245678987653210123456789. - Michael S. Branicky, Jan 26 2024

Examples

			The first term is 1201: increases 1-2, decreases 2-0, then increases 0-1.  An example 7-digit term is 1215679.
		

Crossrefs

Programs

  • Maple
    q:= proc(n) local i, l, s;
          l, s:= convert(n, base, 10), 1;
          for i to nops(l)-1 while s<5 do s:=
           `if`(l[i]=l[i+1], 5,
           `if`(l[i]>l[i+1], [2$2, 4$2][s], [5, 3$2, 5][s]))
          od; is(s=4)
        end:
    select(isprime and q, [$1..15000])[];  # Alois P. Heinz, Jan 26 2024
  • Python
    from sympy import isprime
    from itertools import combinations, islice
    def agen(): # generator of terms
        for d in range(4, 28):
            print(d)
            passed = set()
            for d1 in range(2, min(d-2, 9)+1):
                for c1 in combinations("123456789", d1):
                    for d2 in range(1, min(d-d1-1, 10)+1):
                        digits2 = list(map(str, range(int(c1[-1])-1, -1, -1)))
                        for c2 in combinations(digits2, d2):
                            digits3 = list(map(str, range(int(c2[-1])+1, 11)))
                            for c3 in combinations(digits3, d - d1 - d2):
                                t = int("".join(c1 + c2 + c3))
                                if isprime(t):
                                    passed.add(t)
            yield from sorted(passed)
    print(list(islice(agen(), 63))) # Michael S. Branicky, Jan 26 2024

A371378 Prime numbers wherein digit values decrease, increase, and finally decrease.

Original entry on oeis.org

1021, 1031, 1051, 1061, 1063, 1087, 1091, 1093, 1097, 2053, 2063, 2081, 2083, 2087, 2131, 2141, 2143, 2153, 2161, 3041, 3061, 3083, 3121, 3163, 3181, 3187, 3191, 3251, 3253, 3271, 4021, 4051, 4073, 4091, 4093, 4153, 4231, 4241, 4243, 4253, 4261, 4271, 4273, 4283
Offset: 1

Views

Author

James S. DeArmon, Mar 20 2024

Keywords

Comments

Terms must have at least 4 digits. The sequence is finite.
There are 3136837 terms, with the last being 98765432101234567987654321. - Michael S. Branicky, Mar 20 2024

Crossrefs

Programs

  • Maple
    q:= proc(n) local i, l, s;
          l, s:= convert(n, base, 10), 1;
          for i to nops(l)-1 while s<5 do s:=
           `if`(l[i]=l[i+1], 5,
           `if`(l[i]Alois P. Heinz, Mar 21 2024
  • Mathematica
    Select[Prime[Range[600]], SplitBy[Sign[Differences[IntegerDigits[#]]], Sign][[;; , 1]] == {-1, 1, -1} &] (* Amiram Eldar, Mar 21 2024 *)
  • Python
    from sympy import isprime
    from itertools import combinations, islice
    def agen(): # generator of terms
        for d in range(4, 29):
            print(d)
            passed = set()
            for d1 in range(2, min(d-2, 11)+1):
                for c1 in combinations("9876543210", d1):
                    for d2 in range(1, min(d-d1-1, 10)+1):
                        digits2 = list(map(str, range(int(c1[-1])+1, 10)))
                        for c2 in combinations(digits2, d2):
                            digits3 = list(map(str, range(int(c2[-1])-1, -1, -1)))
                            for c3 in combinations(digits3, d - d1 - d2):
                                t = int("".join(c1 + c2 + c3))
                                if isprime(t):
                                    passed.add(t)
            yield from sorted(passed)
    print(list(islice(agen(), 63))) # Michael S. Branicky, Mar 20 2024

Extensions

More terms from Michael S. Branicky, Mar 20 2024
Showing 1-6 of 6 results.