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

A354113 The smallest number that contains all the digits of n in order but does not equal n.

Original entry on oeis.org

10, 10, 12, 13, 14, 15, 16, 17, 18, 19, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153
Offset: 0

Views

Author

Jianing Song, May 17 2022

Keywords

Comments

If n begins with 1, then a(n) is obtained by inserting a 0 after it; otherwise a(n) is obtained by placing a 1 before n.

Examples

			The smallest number not equal to 19 containing the digits 1 and 9 in that order is 109, so a(19) = 109.
The smallest number not equal to 22 containing two 2's is 122, so a(22) = 122.
		

Crossrefs

Programs

  • PARI
    a(n) = if(n==0, 10, my(k=logint(n,10)); if(n<2*10^k, n+9*10^k, n+10^(k+1)))
    
  • Python
    def a(n):
        if n == 0: return 10
        s = str(n)
        return int(s[0]+"0"+s[1:]) if s[0] == "1" else int("1"+s)
    print([a(n) for n in range(54)]) # Michael S. Branicky, May 17 2022

Formula

If 10^k <= n < 2*10^k, a(n) = n + 9*10^k; if 2*10^k <= n < 10^(k+1), a(n) = n + 10^(k+1).

A381606 a(n) is the smallest prime number greater than n that contains n as a substring of its digits.

Original entry on oeis.org

101, 11, 23, 13, 41, 53, 61, 17, 83, 19, 101, 113, 127, 113, 149, 151, 163, 173, 181, 191, 1201, 211, 223, 223, 241, 251, 263, 127, 281, 229, 307, 131, 1321, 233, 347, 353, 367, 137, 383, 139, 401, 241, 421, 431, 443, 457, 461, 347, 487, 149, 503, 151, 521, 353, 541
Offset: 0

Views

Author

Joost de Winter, Mar 01 2025

Keywords

Examples

			The first prime number greater than 0 that contains "0" is 101, so a(0) = 101.
The first prime number greater than 1 that contains "1" is 11, so a(1) = 11.
The first prime number greater than 2 that contains "2" is 23, so a(2) = 23.
		

Crossrefs

Programs

  • MATLAB
    \\ See De Winter link
    
  • Maple
    f:= proc(n) local m,d,d1,x,y,L;
      m:= length(n);
      for d from 1 do
        L:= sort([seq(10^d * n + x, x = 1 .. 10^d-1, 2),
                 seq(n+10^m*x, x=10^(d-1) .. 10^d-1),
                 seq(seq(seq(10^d1*n + x + 10^(m+d1)*y, x=1 .. 10^d1-1,2),y=10^(d-d1-1) .. 10^(d-d1)-1),d1=1..d-1)]);
        for x in L do if isprime(x) then return x fi od
      od
    end proc:
    f(0):= 101:
    map(f, [$0..100]); # Robert Israel, Mar 02 2025
  • Mathematica
    a[n_] := Module[{p = NextPrime[n + 1], s = ToString[n]}, While[! StringContainsQ[ToString[p], s], p = NextPrime[p]]; p]; Array[a, 100, 0] (* Amiram Eldar, Mar 03 2025 *)
  • PARI
    a(n) = my(p=nextprime(n+1), s=Str(n)); while (#strsplit(Str(p), s) < 2, p = nextprime(p+1)); p; \\ Michel Marcus, Mar 01 2025
    
  • PARI
    \\ See Corneth link

Formula

a(n) > 2n. For large enough n, a(n) < n^5 by the strongest known version of Linnik's theorem. - Charles R Greathouse IV, Mar 01 2025
Showing 1-2 of 2 results.