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.

A209385 Values of the first prefixing digits for Mersenne primes.

Original entry on oeis.org

1, 1, 1, 4, 1, 10, 1, 36, 15, 58, 57, 55, 310, 177, 51, 2389, 973, 532, 1750, 63, 1032, 1240, 3757, 9994, 5854, 12870, 46147, 11923, 17113, 10296, 5977
Offset: 1

Views

Author

Gilbert Mozzo, Mar 07 2012, Mar 18 2012

Keywords

Examples

			For Mersenne 5, i.e., 8191, the first computed prefix is equal to 1 and gives 18191 which is also a prime, so a(5) = 1.
		

Crossrefs

Cf. A000668 (Mersenne primes), A202136.

Programs

  • Mathematica
    pfx[n_] := Module[{w = 10^(1+Floor[Log10[n]])}, k=n+w ; While[!PrimeQ[k], k+=w]; Floor[k/w]]; s={}; Do[m = 2^MersennePrimeExponent[n]-1; AppendTo[s, pfx[m]], {n, 1, 12}]; s (* Amiram Eldar, Nov 22 2018 based on Andrew Howroyd's pari code *)
  • PARI
    pfx(n)={my(w=10^(1+logint(n,10)), k=n+w); while(!ispseudoprime(k), k+=w); k\w}
    { for(n=1, 500, my(p=1<Andrew Howroyd, Nov 17 2018