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

A070750 0 if n-th prime is even, 1 if n-th prime is == 1 (mod 4), and -1 if n-th prime is == 3 (mod 4).

Original entry on oeis.org

0, -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, 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
Offset: 1

Views

Author

Reinhard Zumkeller, May 04 2002

Keywords

Comments

Also, sin(prime(n)*Pi/2), where prime(n) = A000040(n), Pi=3.1415... (original definition).
Also imaginary part of primes mapped as defined in A076340, A076341: a(n) = A076341(A000040(n)), real part = A076342.
Legendre symbol (-1/prime(n)) for n > 1. - T. D. Noe, Nov 05 2003
For n > 1, let p = prime(n) and m = (p-1)/2. Then c(m) - a(n) == 0 (mod p), where c(m) = (2*m)!/(m!)^2 = A000984(m) is the central binomial coefficient. [Proof: By definition, c(m)*(m!)^2 - (p-1)! = 0 and therefore c(m)*(m!)^2*(-1)^(m+1) - (p-1)!*(-1)^(m+1) = 0. Now apply Wilson's theorem, (p-1)! == 1 (mod p), and its corollary, (m!)^2 == (-1)^(m+1) (mod p), and finally use the formula by T. D. Noe listed below to replace (-1)^m with a(n).] Similarly, C_m - 2*a(n) == 0 (mod p), with C_m = A000108(m) being the m-th Catalan number. [Proof: By definition, C_m*(p+1)*(m!)^2 - 2*(p-1)! = 0. The result follows proceeding as in the first proof.] - Stanislav Sykora, Aug 11 2014

Examples

			p = 4*k+1 (see A002144): a(p) = sin((4*k+1)*Pi/2) = sin(2*k*Pi + Pi/2) = sin(Pi/2) = 1.
p = 4*k+3 (see A002145): a(p) = sin((4*k+3)*Pi/2) = sin(2*k*Pi + 3*Pi/2) = sin(3*Pi/2) = -1.
		

Crossrefs

Programs

Formula

a(n) = 2 - prime(n) mod 4 = 2 - A039702(n).
a(n) = (-1)^((prime(n)-1)/2) for n > 1. - T. D. Noe, Nov 05 2003
From Amiram Eldar, Dec 24 2022: (Start)
Product_{n>=1} (1 - a(n)/prime(n)) = 4/Pi (A088538).
Product_{n>=1} (1 + a(n)/prime(n)) = 2/Pi (A060294). (End)

Extensions

Wording of definition changed by N. J. A. Sloane, Jun 21 2015

A076340 Real part of the function defined multiplicatively on the complex numbers by 2->(2,0) and p->((floor(p/4)+floor((p mod 4)/2))*4,2-(p mod 4)) for odd primes p.

Original entry on oeis.org

1, 2, 4, 4, 4, 8, 8, 8, 15, 8, 12, 16, 12, 16, 17, 16, 16, 30, 20, 16, 31, 24, 24, 32, 15, 24, 52, 32, 28, 34, 32, 32, 47, 32, 33, 60, 36, 40, 49, 32, 40, 62, 44, 48, 68, 48, 48, 64, 63, 30, 65, 48, 52, 104, 49, 64, 79, 56, 60, 68, 60, 64, 112, 64, 47, 94, 68, 64, 95, 66, 72
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 08 2002

Keywords

Comments

a(n)>0 for n<2187=3^7, a(2187)=-5816, A076341(2187)=-20047.

Examples

			n=21: 21 = 3*7 = (4-1)*(8-1) = (4,-1)*(8,-1) -> (32-(-1)*(-1),-4+(-8)) = (31,-12), therefore a(21)=31, A076341(21)=-12;
n=35: 35 = 5*7 = (4+1)*(8-1) = (4,1)*(8,-1) -> (32-1*(-1),-4+8) = (33,4), therefore a(35)=33, A076341(35)=4.
		

Crossrefs

Programs

  • Mathematica
    b[n_] := If[n == 1, 1, Product[{p, e} = pe; If[p == 2, 2, ((Floor[p/4] + Floor[Mod[p, 4]/2])*4 + (2 - Mod[p, 4]) I)]^e, {pe, FactorInteger[n]}]];
    a[n_] := Re[b[n]];
    Array[a, 100] (* Jean-François Alcover, Dec 12 2021 *)

Formula

a(A000040(n)) = A076342(n).
a(A001358(n)) = A076343(n).
a(A000961(n)) = A076345(n).
a(A005117(n)) = A076347(n).
a(A000290(n)) = A076349(n).

A076347 A076340(A005117(n)), real part of squarefree numbers mapped as defined in A076340, A076341.

Original entry on oeis.org

1, 2, 4, 4, 8, 8, 8, 12, 12, 16, 17, 16, 20, 31, 24, 24, 24, 28, 34, 32, 47, 32, 33, 36, 40, 49, 40, 62, 44, 48, 48, 65, 52, 49, 79, 56, 60, 60, 64, 47, 94, 68, 95, 66, 72, 72, 72, 95, 98, 80, 80, 84, 63, 88, 113, 88, 97, 127, 96, 81, 96, 100, 130, 104, 136, 104, 108, 108
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 08 2002

Keywords

Examples

			Applying the map as defined in A076340, A076341:
A005117(40)=65=5*13=(4+1)*(12+1) -> (4,1)*(12,1) = (4*12-1,12+4) = (47,16), therefore a(40)=47 and A076348(40)=16.
		

Crossrefs

Imaginary part = A076348, A076342, A076343, A076349.

A082542 a(n) = prime(n) + 2 - (prime(n) mod 4).

Original entry on oeis.org

2, 2, 6, 6, 10, 14, 18, 18, 22, 30, 30, 38, 42, 42, 46, 54, 58, 62, 66, 70, 74, 78, 82, 90, 98, 102, 102, 106, 110, 114, 126, 130, 138, 138, 150, 150, 158, 162, 166, 174, 178, 182, 190, 194, 198, 198, 210, 222, 226, 230, 234, 238, 242, 250, 258, 262, 270, 270, 278
Offset: 1

Views

Author

Reinhard Zumkeller, May 02 2003

Keywords

Comments

For k > 1: a(k+1) = a(k) if and only if prime(k) == 1 modulo 4 and prime(k+1) = prime(k) + 2, see A071695 and A071696.

Examples

			a(2) = 2 because the second prime is 3, and 3 + 2 - 3 = 2.
a(3) = 6 because the third prime is 5, and 5 + 2 - 1 = 6.
a(4) = 6 because the fourth prime is 7, and 7 + 2 - 3 = 6.
		

Crossrefs

Programs

  • Magma
    [2 + NthPrime(n) - (NthPrime(n) mod 4): n in [1..60]]; // G. C. Greubel, Nov 14 2018
  • Mathematica
    Table[Prime[n] + 2 - Mod[Prime[n], 4], {n, 60}] (* Alonso del Arte, Feb 23 2015 *)
    #+2-Mod[#,4]&/@Prime[Range[60]] (* Harvey P. Dale, Aug 24 2025 *)
  • PARI
    vector(60, n, 2 + prime(n) - lift(Mod(prime(n),4))) \\ G. C. Greubel, Nov 14 2018
    

Formula

a(n) = A000040(n) + A070750(n).
a(n+1) = p + (-1/p) = p + (-1)^((p-1)/2), where p is the n-th odd prime and (-1/p) denotes the value of Legendre symbol. - Lekraj Beedassy, Mar 17 2005
a(n) = (A000040(n) OR 3) - 1. - Jon Maiga, Nov 14 2018
From Amiram Eldar, Dec 24 2022: (Start)
a(n) = A100484(n) - A076342(n).
Product_{n>=1} a(n)/prime(n) = 2/Pi (A060294). (End)

A076343 A076340(A001358(n)), real part of semiprimes mapped as defined in A076340, A076341.

Original entry on oeis.org

4, 8, 15, 8, 16, 17, 31, 24, 15, 24, 47, 32, 33, 40, 49, 48, 63, 65, 49, 79, 56, 64, 47, 95, 72, 95, 80, 63, 88, 113, 97, 127, 96, 81, 104, 145, 97, 120, 129, 143, 120, 161, 175, 159, 136, 191, 144, 145, 111, 144, 129, 160, 209, 191, 168, 143, 239, 176, 241, 143
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 08 2002

Keywords

Examples

			Applying the map as defined in A076340, A076341:
A001358(15)=39=3*13=(4-1)*(12+1) -> (4,-1)*(12,1) = (4*12+1,4-12) = (49,-8), therefore a(15)=49 and A076344(120)=-8.
		

Crossrefs

Imaginary part = A076344, A076342, A076347.

A076345 A076340(A000961(n)), real part of prime powers mapped as defined in A076340, A076341.

Original entry on oeis.org

1, 2, 4, 4, 4, 8, 8, 15, 12, 12, 16, 16, 20, 24, 15, 52, 28, 32, 32, 36, 40, 44, 48, 63, 52, 60, 60, 64, 68, 72, 72, 80, 161, 84, 88, 96, 100, 104, 108, 108, 112, 143, 52, 128, 128, 132, 136, 140, 148, 152, 156, 164, 168, 143, 172, 180, 180, 192, 192, 196, 200, 212
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 08 2002

Keywords

Examples

			Applying the map as defined in A076340, A076341:
A000961(16)=27=3*3*3=(4-1)*(4-1)*(4-1) -> (4,-1)*(4,-1)*(4,-1) = (4*4-1,-8)*(4,-1) = (4*15-8,-32-15) = (52,-47), therefore a(16)=52 and A076346(16)=-47.
		

Crossrefs

Imaginary part = A076346, A076342.

A261208 Terms of the Leibniz formula (as Euler product) that generate successively better approximations to Pi.

Original entry on oeis.org

1, 3, 4, 5, 8, 47, 49, 95, 247, 251, 253, 742, 4268, 4270, 4288, 11445, 30123, 30701, 30703, 62592, 62690, 62992, 3535871, 3535872, 3664203, 3664204, 3664214, 3664220, 3665670, 3665696, 3665842, 3665854, 3665866, 3708907, 3708909, 3708913, 3708929, 3708931, 3708935, 3708957, 3708983, 3708985, 3709017
Offset: 1

Views

Author

Steven Lubars, Aug 11 2015

Keywords

Examples

			Calculating the first 8 terms: c(1)=3, c(2)=3.75, c(3)=3.28125, c(4)=3.0078125, c(5)=3.2584635416, c(6)=3.462117513020833, c(7)=3.289011637369791, c(8)=3.1519694858127165.
In the above sequence, terms 1, 3, 4, 5, and 8 provide successively closer approximations of Pi (whereas approximations 2, 6, and 7 do not).
		

Crossrefs

Programs

  • MUMPS
    s Pi=3.141592653589793238,a=3,n=1,d=Pi-a
    w !,1
    f i=6:6:1e10 d
      s L=i+1**.5\1
      f j=i-1:2:i+1 d
        f k=3:2:L q:'(j#k)
        i j#k d
          s a=a*j/(j#4+j-2),n=n+1
          i $FN(Pi-a,"-")Steven Lubars, Aug 14 2015
  • PARI
    nearmul(p) = if (p % 4 == 1, p-1, p+1);
    lista(nn) = {print1(lb = 1, ", "); v = 3; ld = abs(Pi-3); for (n=2, nn, np = prime(n+1); v *= np/nearmul(np); if ((nld=abs(Pi-v)) < ld, print1(n, ", "); ld = nld););} \\ Michel Marcus, Aug 14 2015
    

Formula

Pi = 4*b(1)*b(2)*b(3)*... where b(n) is the n-th odd prime (A065091) divided by its nearest multiple of 4.
Let c(n) be the n-th term of the expansion such that c(n) = 4*b(1)*...*b(n). The sequence consists of the values n such that c(n) provides a closer approximation of Pi than previous approximations c(1)...c(n-1).
Showing 1-7 of 7 results.