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.

A268702 Largest n digit prime having at least n-1 digits equal to 1.

Original entry on oeis.org

7, 71, 911, 8111, 16111, 911111, 1171111, 71111111, 131111111, 1711111111, 31111111111, 311111111111, 5111111111111, 41111111111111, 111151111111111, 5111111111111111, 11111611111111111, 191111111111111111, 2111111111111111111, 11111111611111111111
Offset: 1

Views

Author

Keywords

Examples

			a(3) = 911 since 111, 211, 311, ..., 811 are all composites but 911 is prime. Also of the ten primes of 3 digits which contain at least 2 ones, {101, 113, 131, 151, 181, 191, 211, 311, 811, 911}, 911 is the greatest.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{k = 0, p = {}, r = (10^n - 1)/9, s = Range@ 10 - 2}, While[k < n, AppendTo[p, Select[r + 10^k*s, PrimeQ]]; k++]; p = Max@ Flatten@ p]; Array[f, 20]
  • PARI
    a(n) = {p = precprime(10^n-1); while (#select(x->x==1, digits(p)) != n-1, p = precprime(p-1)); p;} \\ Michel Marcus, Feb 21 2016

A268706 Largest n-digit prime having at least n-1 digits equal to 7.

Original entry on oeis.org

7, 97, 977, 7877, 97777, 787777, 7877777, 77777747, 787777777, 8777777777, 79777777777, 777777779777, 7877777777777, 77777779777777, 778777777777777, 8777777777777777, 77797777777777777, 797777777777777777, 7777877777777777777, 97777777777777777777
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    f:= proc(n)
      local r,i,j,p;
      r:= 7*(10^n-1)/9;
      for p in sort([r, seq(seq(r + i*10^j, i=[$(-7)..(-1),1,2]),j=0..n-1)],`>`) do
        if isprime(p) then return p fi
      od;
      error("no prime found")
    end proc:
    map(f, [$1..100]); # Robert Israel, Feb 24 2016
  • Mathematica
    f[n_] := Block[{k = 0, p = {}, r = 7 (10^n - 1)/9, s = Range@ 10 - 8}, While[k < n, AppendTo[p, Select[r + 10^k*s, PrimeQ]]; k++]; p = Max@ Flatten@ p]; Array[f, 20]
Showing 1-2 of 2 results.