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-10 of 14 results. Next

A376129 Run lengths of the most significant decimal digit in the primes (A077648).

Original entry on oeis.org

1, 1, 1, 1, 4, 2, 2, 3, 2, 2, 3, 2, 1, 21, 16, 16, 17, 14, 16, 14, 15, 14, 135, 127, 120, 119, 114, 117, 107, 110, 112, 1033, 983, 958, 930, 924, 878, 902, 876, 879, 8392, 8013, 7863, 7678, 7560, 7445, 7408, 7323, 7224, 70435, 67883, 66330, 65367, 64336, 63799, 63129, 62712, 62090
Offset: 1

Views

Author

Stuart Coe, Sep 11 2024

Keywords

Examples

			The primes and the run lengths of their initial digits begin
  primes   2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, ...
  runs                 \------------/  \----/  \----/
  lengths  1  1  1  1         4          2       2     ...
		

Crossrefs

Programs

  • Python
    from sympy import primepi
    def A376129(n):
        if n<5: return 1
        def f(m): return (lambda x:primepi(10**x[0]*(x[1]+1)))(divmod(m,9))
        return int(f(n+5)-f(n+4)) # Chai Wah Wu, Oct 16 2024

Formula

a(n) = A000720(A037124(n+6)) - A000720(A037124(n+5)) for n >= 5. - Pontus von Brömssen, Oct 07 2024

A138840 Concatenation of initial and final digits of n-th prime.

Original entry on oeis.org

22, 33, 55, 77, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 11, 13, 17, 19, 13, 17, 11, 17, 19, 19, 11, 17, 13, 17, 13, 19, 11, 11, 13, 17, 19, 21, 23, 27, 29, 23, 29, 21, 21, 27, 23, 29, 21, 27, 21, 23, 23, 37, 31, 33, 37, 31, 37, 37
Offset: 1

Views

Author

Omar E. Pol, Apr 01 2008

Keywords

Comments

There are only 38 distinct terms in this sequence, all of them odd with the exception of 22. 55 is the only term divisible by 5. 22 and 55 each appear only once. The other terms, each of which appears multiple times, are the odd two-digit numbers not divisible by 5. - Harvey P. Dale, May 15 2012
a(n) is the concatenation of A077648(n) and A007652(n), hence all terms of this sequence have two digits in the same way as A073729. - Omar E. Pol, Mar 23 2018

Crossrefs

Cf. A137589 (same except for first four terms).

Programs

  • Maple
    a:= n-> (p-> parse(cat(p[1], p[-1])))(""||(ithprime(n))):
    seq(a(n), n=1..92);  # Alois P. Heinz, Nov 23 2023
  • Mathematica
    cifd[n_]:=Module[{il=IntegerLength[n],idn=IntegerDigits[n]},Which[ il==1, 10n+n, il==2,n,il>2,FromDigits[Join[{First[idn],Last[idn]}]]]]; cifd/@ Prime[ Range[70]] (* Harvey P. Dale, May 15 2012 *)
  • PARI
    a(n) = my(d=digits(prime(n))); fromdigits(concat(d[1], d[#d])); \\ Michel Marcus, Mar 23 2018

A135617 a(n) is the initial digit of n-th even perfect number.

Original entry on oeis.org

6, 2, 4, 8, 3, 8, 1, 2, 2, 1, 1, 1, 2, 1, 5, 1, 9, 3, 1, 4, 1, 5, 3, 9, 1, 8, 3, 1, 1, 1, 2, 1, 8, 8, 3, 1, 8, 9, 4, 7, 4, 7, 4, 7, 2, 1, 5, 1
Offset: 1

Views

Author

Omar E. Pol, Mar 01 2008

Keywords

Comments

a(n) is also the initial digit of n-th perfect number A000396(n) if there are no odd perfect numbers.

Examples

			a(5) = 3 because the 5th even perfect number is 33550336 and the initial digit of 33550336 is 3.
		

Crossrefs

Programs

  • Mathematica
    lst = {* the list of terms in A000043 *}; f[n_] := Block[{pn = (2^n - 1) (2^(n - 1))}, Quotient[pn, 10^Floor[ Log[10, pn]] ]]; f@# & /@ lst (* Robert G. Wilson v, Apr 01 2008 *)

Extensions

More terms from Robert G. Wilson v, Apr 01 2008
Definition clarified by Omar E. Pol, Apr 14 2018
a(40)-a(47) from Ivan Panchenko, Apr 16 2018
a(48) from Amiram Eldar, Oct 16 2024

A135613 Initial digit of Mersenne primes A000668.

Original entry on oeis.org

3, 7, 3, 1, 8, 1, 5, 2, 2, 6, 1, 1, 6, 5, 1, 1, 4, 2, 1, 2, 4, 3, 2, 4, 4, 4, 8, 5, 5, 5, 7, 1, 1, 4, 8, 6, 1, 4, 9, 1, 2, 1, 3, 1, 2, 1, 3, 5
Offset: 1

Views

Author

Omar E. Pol, Mar 01 2008

Keywords

Examples

			a(4) = 1 because the 4th Mersenne prime A000668(4) is 127 and the initial digit of 127 is 1.
		

Crossrefs

Programs

  • Mathematica
    lst = {* the list of terms in A000043 *}; f[n_] := Block[{pn = 2^n - 1}, Quotient[pn, 10^Floor[ Log[10, pn]] ]]; f@# & /@ lst (* Robert G. Wilson v, Apr 01 2008 *)
    IntegerDigits[#][[1]]&/@(2^#-1&/@MersennePrimeExponent[Range[47]]) (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 04 2019 *)

Formula

a(n) = A000030(A000668(n)). - Omar E. Pol, Jul 04 2019

Extensions

More terms from Robert G. Wilson v, Apr 01 2008
a(40)-a(44) from David Radcliffe, Jan 21 2016
a(45)-a(47) from Ivan Panchenko, Apr 11 2018
a(48) from Amiram Eldar, Oct 16 2024

A138125 Final digit of n-th even superperfect number A061652(n).

Original entry on oeis.org

2, 4, 6, 4, 6, 6, 4, 4, 6, 6, 4, 4, 6, 4, 4, 4, 6, 6, 6, 4, 6, 6, 6, 6, 6, 6, 6, 4, 4, 6, 4, 4, 6, 4, 6, 6, 6, 6, 6, 4, 4, 4, 6, 6, 4, 6, 6
Offset: 1

Views

Author

Omar E. Pol, Apr 01 2008, corrected Apr 03 2008

Keywords

Comments

Also, final digit of n-th superperfect number A019279(n), if there are no odd superperfect numbers.

Examples

			a(5)=6 because the 5th even superperfect number A061652(5) is 4096 and the final digit of 4096 is 6.
a(34)=4 because the final digit of 34th Mersenne prime is 7. a(39)=6 because the final digit of 39th Mersenne prime is 1.
.............................................................
............... SHORT TABLE OF FINAL DIGITS .................
.............................................................
Final digit of ..... Final digit of Even ..... Final digit of
Mersenne prime ..... Superperfect number ..... Perfect number
A000668 ............ A061652 ................. A000396........
(3) ................ (2) ..................... (6) ........... (For n=1, only)
(7) ................ (4) ..................... (8) ...........
(1) ................ (6) ..................... (6) ...........
		

Crossrefs

Programs

  • Mathematica
    Mod[#,10]&/@(2^(MersennePrimeExponent[Range[47]]-1)) (* Harvey P. Dale, Feb 23 2023 *)

Formula

a(1)=2. For n>1, if final digit of n-th Mersenne prime A000668(n) is equal to 1 then a(n)=6, otherwise a(n)=4.

Extensions

a(40)-a(47) from Jinyuan Wang, Mar 14 2020

A166499 Concatenation of the rightmost digit of the n-th prime and the leftmost digit of the (n+1)th prime.

Original entry on oeis.org

23, 35, 57, 71, 11, 31, 71, 92, 32, 93, 13, 74, 14, 34, 75, 35, 96, 16, 77, 17, 37, 98, 38, 99, 71, 11, 31, 71, 91, 31, 71, 11, 71, 91, 91, 11, 71, 31, 71, 31, 91, 11, 11, 31, 71, 92, 12, 32, 72, 92, 32, 92, 12, 12, 72, 32, 92, 12, 72, 12, 32, 33, 73, 13, 33, 73, 13, 73, 73
Offset: 1

Views

Author

Zak Seidov, Oct 15 2009

Keywords

Comments

This is the comma transform of the primes (see A367360).

Crossrefs

Programs

  • Maple
    a:= n-> parse(cat(""||(ithprime(n))[-1],""||(ithprime(n+1))[1])):
    seq(a(n), n=1..99);  # Alois P. Heinz, Nov 22 2023
  • Mathematica
    With[{nmax=100},Map[10Mod[#[[1]],10]+IntegerDigits[#[[2]]][[1]]&,Partition[Prime[Range[nmax+1]],2,1]]] (* Paolo Xausa, Nov 24 2023 *)

Formula

a(n) = 10 * A007652(n) + A077648(n+1). - Alois P. Heinz, Nov 23 2023

A138124 Initial digit of n-th even superperfect number A061652(n).

Original entry on oeis.org

2, 4, 1, 6, 4, 6, 2, 1, 1, 3, 8, 8, 3, 2, 5, 7, 2, 1, 9, 1, 2, 1, 1, 2, 2, 2, 4, 2, 2, 2, 3, 8, 6, 2, 4, 3, 6, 2, 4
Offset: 1

Views

Author

Omar E. Pol and Robert G. Wilson v, Apr 01 2008

Keywords

Comments

Also, initial digit of n-th superperfect number A019279(n), if there are no odd superperfect numbers.

Examples

			a(5)=4 because the 5th even superperfect number A061652(5) is 4096 and the initial digit of 4096 is 4.
		

Crossrefs

Programs

  • Mathematica
    lst = {2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433, 1257787, 1398269, 2976221, 3021377, 6972593, 13466917}; f[n_] := Block[{pn = 2^(n - 1)}, Quotient[pn, 10^Floor[Log[10, pn]]]]; f@# & /@ (* Robert G. Wilson v, Apr 01 2008 *)

Extensions

a(13)-a(39) from Robert G. Wilson v, Apr 01 2008

A093339 Middle digits of primes with an odd number of digits.

Original entry on oeis.org

2, 3, 5, 7, 0, 0, 0, 0, 1, 2, 3, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 9, 1, 2, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 0, 1, 1, 1, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 0, 0, 1, 2, 3, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 9, 0, 0, 2, 2, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 0, 0, 1, 1, 1, 3, 4, 4, 4, 5, 5, 6, 7, 7, 8, 9, 0
Offset: 2

Views

Author

Cino Hilliard, Apr 25 2004

Keywords

Crossrefs

Programs

  • Mathematica
    mdp[n_]:=Module[{idn=IntegerDigits[n],len=IntegerLength[n]},If[EvenQ[len], -1,idn[[(len-1)/2+1]]]]; Select[mdp/@Prime[Range[500]],NonNegative] (* Harvey P. Dale, Feb 26 2012 *)
  • PARI
    midd(n) = { forprime(x=2,n, s = Str(x); ln = length(s); if(ln<2,p=1,p = (ln-1)/2+1); if(ln%2, md = eval(mid(s,p,1)); print1(md",") ) ) } \ Get a substring of length n from string str starting at position s in str. mid(str,s,n) = { v =""; tmp = Vec(str); ln=length(tmp); for(x=s,s+n-1, v=concat(v,tmp[x]); ); return(v) }

A093336 Second digit of prime(n).

Original entry on oeis.org

1, 3, 7, 9, 3, 9, 1, 7, 1, 3, 7, 3, 9, 1, 7, 1, 3, 9, 3, 9, 7, 0, 0, 0, 0, 1, 2, 3, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 9, 1, 2, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 0, 1, 1, 1, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 0, 0, 1, 2, 3, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 9, 0, 0, 2, 2, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9
Offset: 5

Views

Author

Cino Hilliard, Apr 25 2004

Keywords

Crossrefs

Programs

  • Mathematica
    IntegerDigits[#][[2]]&/@Prime[Range[5,110]] (* Harvey P. Dale, Dec 22 2013 *)
  • PARI
    second(n) = { forprime(x=11,n, sd = mid(Str(x),2,1); print1(sd",") ) } \ Get a substring of length n from string str starting at position s in str. mid(str,s,n) = { v =""; tmp = Vec(str); ln=length(tmp); for(x=s,s+n-1, v=concat(v,tmp[x]); ); return(v) }

Extensions

Offset corrected by Matthew House, Aug 09 2015

A120843 Initial digit of the (10^n)-th prime.

Original entry on oeis.org

2, 2, 5, 7, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 0

Views

Author

Cino Hilliard, Aug 18 2006

Keywords

Comments

The algorithm in the PARI program approximates the (10^n)-th prime to an accuracy of roughly n/2 + 1 digits. As a result, we are almost certain to get the initial digit correctly. It remains to prove this. Since the Riemann approximation of pi(x) is used as a boundary in the exponential bisection routine, it would seem that a proof is possible in view of the fact that bisection almost always guarantees convergence. "Almost" is an appropriate term here, as will be demonstrated when we let the initial parameter r2 = 1. For example, we can toggle print(dx) to check the convergence. For primex(1e116), we get 9.999999999999999999999999970 E115.

Examples

			The (10^3)-th prime is 7919, so a(3)=7.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := RealDigits[ n (Log[n] + Log[Log[n]] - 1 + (Log[Log[n]] - 2)/Log[n] - (Log[Log[n]]^2 - 6 Log[Log[n]] + 11)/(2 Log[n]^2)), 10, 10][[1, 1]]; f[1] = f[10] = 2; f[100] = 5; Array[ f[10^#] &, 105, 0] (* Robert G. Wilson v, Jan 15 2017 *)
  • PARI
    g(n) = print1(2", "); for(x=1, n, y=Vec(Str(primex(10^x))); print1(y[1]", "))
    primex(n) = /* Efficient Algorithm to accurately approximate the n-th prime */ { local(x, px, r1, r2, r, p10, b, e); b=10; /*Select base*/ p10=log(n)/log(10); /*p10=pow of 10 n is to adjust in b^p10*/ if(Rg(b^p10*log(b^(p10+1)))< b^p10, m=p10+1, m=p10); r1 = 0; r2 = 2.718281828; /*Real kicker. if 1, it fails at 1e117*/ for(x=1, 360, r=(r1+r2)/2; px = Rg(b^p10*log(b^(m+r))); if(px <= b^p10, r1=r, r2=r); r=(r1+r2)/2.; ); (b^p10*log(b^(m+r))+.5); }
    Rg(x) = /* Gram's Riemann's Approx of Pi(x) */{ local(n=1, L, s=1, r); L=r=log(x); while(s<10^100*r, s=s+r/zeta(n+1)/n; n=n+1; r=r*L/n); (s) }

Formula

a(n) = most significant digit of A006988(n). - Robert G. Wilson v, Jan 17 2017
a(n) = A000030(A006988(n)). - Michel Marcus, Jan 18 2017
Showing 1-10 of 14 results. Next