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-3 of 3 results.

A059168 Primes in which digits alternately rise and fall (or vice versa); sometimes called undulating primes.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 131, 151, 163, 173, 181, 191, 193, 197, 241, 251, 263, 271, 281, 283, 293, 307, 313, 317, 353, 373, 383, 397, 401, 409, 419, 439, 461, 463, 487, 491
Offset: 1

Views

Author

N. J. A. Sloane, Feb 14 2001

Keywords

References

  • C. A. Pickover, "Wonders of Numbers", Oxford New York 2001, Chapter 52, pp. 123-124, 316-317.

Crossrefs

Programs

  • Maple
    extend:= proc(n) local L,j;
      L:= convert(n,base,10);
      if (L[-1] < L[-2]) xor (nops(L)::odd) then
        seq(10*n+j,j=0..L[1]-1)
      else
        seq(10*n+j,j=L[1]+1..9)
      fi
    end proc:
    und[2]:= [seq(seq(10*i+j,j=subs(i=NULL,[$0..9])),i=1..9)]:
    for i from 3 to 4 do und[i]:= map(extend,und[i-1]) od:
    select(isprime, [2,3,5,7,seq(op(und[i],i=2..4)]); # Robert Israel, Nov 15 2018
  • Mathematica
    d[n_]:=Differences[IntegerDigits[n]]; mQ[n_]:=MemberQ[d[n],0]==False; a[n_]:=DeleteDuplicates[Sign[Take[d[n],{1,-1,2}]]]; b[n_]:=DeleteDuplicates[Sign[Take[d[n],{2,-1,2}]]]; t={}; Do[p=Prime[n]; If[mQ[p],If[Length[IntegerDigits[p]]<=2,AppendTo[t,p],If[Length[a[p]]==Length[b[p]]==1 && a[p][[1]]!=b[p][[1]],AppendTo[t,p]]]],{n,95}]; t (* Jayanta Basu, May 08 2013 *)
    Table[Which[p<10,p,p<100&&Differences[IntegerDigits[p]]!={0},p,p>100&&Union[Total/@ Partition[Sign[Differences[IntegerDigits[p]]],2,1]]=={0},p,True,Nothing],{p,Prime[ Range[ 150]]}] (* Harvey P. Dale, Aug 07 2023 *)
  • Python
    from sympy import isprime
    def f(w,dir):
        if dir == 1:
            for s in w:
                for t in range(int(s[-1])+1,10):
                    yield s+str(t)
        else:
            for s in w:
                for t in range(0,int(s[-1])):
                    yield s+str(t)
    A059168_list = []
    for l in range(5):
        for d in '123456789':
            x = d
            for i in range(1,l+1):
                x = f(x,(-1)**i)
            A059168_list.extend([int(p) for p in x if isprime(int(p))])
            if l > 0:
                y = d
                for i in range(1,l+1):
                    y = f(y,(-1)**(i+1))
                A059168_list.extend([int(p) for p in y if isprime(int(p))]) # Chai Wah Wu, Apr 25 2021

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Feb 15 2001
Offset changed by Robert Israel, Nov 15 2018

A385481 Primes whose decimal expansion consists of the concatenation of ij, iijj, iiijjj,..., and m i’s followed by m j’s, i != j, where 1<= i, j <= 9 and m > 0.

Original entry on oeis.org

13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 31331133311133331111, 37337733377733337777, 43443344433344443333, 49449944499944449999
Offset: 1

Views

Author

Gonzalo Martínez, Jun 30 2025

Keywords

Comments

a(25) has 812 digits and starts with 292299222999...999, where the last concatenated strings have 28 2's followed by 28 9's.
Since each term is prime, then j = 1, 3, 7, and 9 and i + j == 1, 2 (mod 3).
m == 1 (mod 3). Proof. If k is a term whose last concatenated string has m i's followed by m j's, then it has 2(1 + 2 + ... + m) = m(m + 1) digits, whose sum is (i + j)*m(m + 1)/2, so that if m == 0, 2 (mod 3), then the sum of digits of k is a multiple of 3 and so k is not prime.
Are there infinite primes of this form?
From Michael S. Branicky, Jul 01 2025: (Start)
A probabilistic argument suggests the sequence is finite.
a(26), if it exists, has m > 321 and > 103362 digits. (End)

Examples

			for i = 3, j = 1 and m = 4, by concatenating 31, 3311, 333111, 33331111 the prime 31331133311133331111 is obtained.
		

Crossrefs

Programs

  • Python
    from gmpy2 import is_prime, mpz
    from itertools import count, islice, product
    def agen(): yield from (p for m in count(1) for i in "123456789" for j in "1379" if i != j and is_prime(p:=int(mpz("".join(i*k+j*k for k in range(1, m+1))))))
    print(list(islice(agen(), 24))) # Michael S. Branicky, Jun 30 2025

A385637 Primes whose decimal expansion consists of the concatenation of m i’s followed by m j’s, ..., iiijjj, iijj and ij, i != j, where 1 <= i, j <= 9 and m > 0.

Original entry on oeis.org

13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 44443333444333443343, 55555553333333555555333333555553333355553333555333553353
Offset: 1

Views

Author

Gonzalo Martínez, Jul 05 2025

Keywords

Comments

Similar to A385481, but the blocks of i's and j's are concatenated from longest length to shortest, where a(n) contains terms of a length not recorded in A385481, such as length 56, 182 and 272.
a(23) has 182 digits and starts with 13 2's followed by 13 9's.
a(24) has 272 digits and starts with 16 9's followed by 16 7's.
a(25), if it exists, has m > 200 and > 40200 digits.

Examples

			For i = 4, j = 3 and m = 4, by concatenating 44443333, 444333, 4433 and 43 the prime 44443333444333443343 is obtained.
		

Crossrefs

Showing 1-3 of 3 results.