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.

A242541 Undulating primes: prime numbers whose digits follow the pattern A, B, A, B, A, B, A, B, ...

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929, 18181, 32323, 35353, 72727, 74747, 78787, 94949, 95959, 1212121, 1616161, 323232323
Offset: 1

Views

Author

J. Lowell, May 17 2014

Keywords

Comments

All numbers in this sequence with three or more digits must have an odd number of digits. Any number with an even number of digits that follow this pattern is divisible by a number of the form 1010101...1010101 where the number of digits is one less than the number of digits in the original number.
Union of A004022 and A032758. - Arkadiusz Wesolowski, May 17 2014
Because A may equal B, 11 (and other prime repunits) are terms in this sequence (but not of A032758). - Harvey P. Dale, May 26 2015

Examples

			121 = 11*11 is not prime and thus is not a term of this sequence.
		

Crossrefs

Programs

  • Maple
    select(isprime,[$0..99,seq(seq(seq(a*(10^(d+1)-10^(d+1 mod 2))/99 + b*(10^d - 10^(d mod 2))/99, b=0..9),a=1..9,2),d=3..9,2)]); # Robert Israel, Jul 08 2016
  • Mathematica
    Select[Union[Flatten[Table[FromDigits[PadRight[{},n,#]],{n,9}]&/@ Tuples[ Range[0,9],2]]],PrimeQ] (* Harvey P. Dale, May 26 2015 *)
  • Python
    from itertools import count, islice
    from sympy import isprime, primerange
    def agen(): # generator of terms
        yield from primerange(2, 100)
        yield from (t for t in (int((A+B)*d2+A) for d2 in count(1) for A in "1379" for B in "0123456789") if isprime(t))
    print(list(islice(agen(), 51))) # Michael S. Branicky, Jun 09 2022