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.

Previous Showing 11-20 of 27 results. Next

A100672 a(1) = 1; thereafter, a(n) = 1 if n-th prime is 3 mod 4, 0 if n-th prime is 1 mod 4.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1
Offset: 1

Views

Author

Joseph Biberstine (jrbibers(AT)indiana.edu), Dec 06 2004

Keywords

Comments

Second least-significant bit in the binary expansion of the n-th prime.
a(n)=1 iff prime(n) is a member of A045326 (equivalently for n>1, iff prime(n)-3 is divisible by 4).

Examples

			a(2)=1 because prime(2)=11_2 (in binary; decimal = 3_10) and its 2^1 bit is 1.
a(3)=0 because prime(3)=101_2 (in binary; decimal = 5_10) and its 2^1 bit is 0.
		

Crossrefs

RUNS transform is essentially A091237.

Programs

  • Maple
    A100672 := proc(n)
            if n = 1 then
                    1 ;
            else
                    ((ithprime(n) mod 4)-1)/2;
            end if;
    end proc: # R. J. Mathar, Oct 06 2011
  • Mathematica
    Table[Reverse[RealDigits[Prime[k], 2][[1]]][[2]], {k, 1, 128}]
  • PARI
    for(k=1,105,print1( bittest(prime(k), 1), ", ")) \\ Washington Bomfim, Jan 18 2011
    
  • Python
    from sympy import prime
    def A100672(n): return int(prime(n)>>1&1) # Chai Wah Wu, Jun 23 2023

Formula

a(n) = 1-A098033(n), n>1. - Steven G. Johnson (stevenj(AT)math.mit.edu), Sep 18 2008
a(n) = floor(prime(n)/2) mod 2. - Alois P. Heinz, Jul 16 2024

Extensions

Edxited by N. J. A. Sloane, Jan 11 2025

A145994 Last prime in a run of at least 2 consecutive primes of the form 4k+3.

Original entry on oeis.org

11, 23, 47, 71, 83, 107, 131, 167, 227, 311, 367, 383, 443, 503, 631, 647, 691, 727, 751, 827, 863, 919, 971, 991, 1091, 1171, 1283, 1319, 1427, 1451, 1471, 1487, 1543, 1583, 1667, 1787, 1847, 1871, 1987, 2011, 2087, 2111, 2207, 2267, 2351, 2411, 2467, 2543, 2591, 2671, 2687
Offset: 1

Views

Author

Enoch Haga, Oct 26 2008

Keywords

Examples

			a(1)=11 because this sequence includes consecutive runs of any length >1 and this ending term in a run of 2 is 11.
		

References

  • Enoch Haga, Exploring Primes on Your PC and the Internet, 1994-2007. Pp. 30-31. ISBN 978-1-885794-24-6

Crossrefs

Cf. A039702, A055623, A145986, A145988, A145990, A145991, A145992 (run lengths), A145993 (first prime in run)

Programs

  • Maple
    A145994 := proc()
        local m,p,r,i,lp ;
        m := 3 ;
        p := 2 ;
        r := 0 ;
        for i from 2 to 1000 do
            if modp(p,4) = m then
                r := r+1 ;
            else
                if r > 1 then
                    printf("%d,",prevprime(p)) ;
                end if;
                r := 0;
            end if;
            p := nextprime(p) ;
        end do:
    end proc:
    A145994() ; # R. J. Mathar, Aug 29 2018
  • Mathematica
    Last /@ Select[Split[Select[4Range[1000]+3, PrimeQ], #2 == NextPrime[#1]&], Length[#]>1&] (* Jean-François Alcover, Mar 26 2020 *)
  • UBASIC
    10 'cluster primes
    20 C=1
    30 input "end #";L
    40 for N=3 to L step 2
    50 S=int(sqrt(N))
    60 for A=3 to S step 2
    70 B=N/A
    80 if int(B)*A=N then cancel for:goto 170
    90 next A
    100 C=C+1
    110 E=N/4:E=int(E):R=N-(4*E)
    120 if R=1 then print N;:C1=C1+1:T1=T1+1:print T1
    130 if R=3 then T1=0
    140 if R=3 then print " ";N;:C3=C3+1:T2=T2+1:print T2
    150 if R=1 then T2=0
    160 if T1>10 or T2>10 then stop
    170 next
    180 print "Total primes=";C;:print "Type A";C1;"Type B";C3

A145990 Primes which start a run of at least length 2 of consecutive primes == 1 (mod 4).

Original entry on oeis.org

13, 37, 89, 109, 193, 229, 277, 313, 349, 389, 449, 509, 613, 661, 701, 757, 797, 853, 877, 929, 997, 1093, 1109, 1193, 1237, 1297, 1373, 1429, 1489, 1549, 1597, 1609, 1637, 1669, 1709, 1733, 1789, 1873, 1889, 1933, 1993, 2069, 2113, 2137, 2153, 2213, 2269
Offset: 1

Views

Author

Enoch Haga, Oct 26 2008

Keywords

Examples

			a(1)=13 because this sequence includes consecutive runs of any length and this first term > 1 in a run of 2 is 13.
		

References

  • Enoch Haga, Exploring Primes on Your PC and the Internet, 1994-2007, pp. 30-31. ISBN 978-1-885794-24-6

Crossrefs

Programs

  • Maple
    for i from 2 to 300 do
            if (ithprime(i) mod 4) = 1  and ithprime(i-1) mod 4 <> 1 and ithprime(i+1) mod 4 = 1 then
                    printf("%d,",ithprime(i)) ;
            end if;
    end do: # R. J. Mathar, Sep 30 2011
  • Mathematica
    Prime[#+1]&/@(SequencePosition[Table[If[Mod[n,4]==1,1,0],{n,Prime[ Range[ 350]]}],{0,1,1},Overlaps->False][[All,1]]) (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 02 2017 *)
  • UBASIC
    10 'cluster primes
    20 C=1
    30 input "end #";L
    40 for N=3 to L step 2
    50 S=int(sqrt(N))
    60 for A=3 to S step 2
    70 B=N/A
    80 if int(B)*A=N then cancel for:goto 170
    90 next A
    100 C=C+1
    110 E=N/4:E=int(E):R=N-(4*E)
    120 if R=1 then print N;:C1=C1+1:T1=T1+1:print T1
    130 if R=3 then T1=0
    140 if R=3 then print " ";N;:C3=C3+1:T2=T2+1:print T2
    150 if R=1 then T2=0
    160 if T1>10 or T2>10 then stop
    170 next
    180 print "Total primes=";C;:print "Type A";C1;"Type B";C3

Extensions

Corrected and extended by Harvey P. Dale, Aug 02 2017

A075520 4*prime(n) + (prime(n) mod 4).

Original entry on oeis.org

10, 15, 21, 31, 47, 53, 69, 79, 95, 117, 127, 149, 165, 175, 191, 213, 239, 245, 271, 287, 293, 319, 335, 357, 389, 405, 415, 431, 437, 453, 511, 527, 549, 559, 597, 607, 629, 655, 671, 693, 719, 725, 767, 773, 789, 799, 847, 895, 911, 917, 933, 959, 965
Offset: 1

Views

Author

Reinhard Zumkeller, Sep 19 2002

Keywords

Crossrefs

Programs

  • Haskell
    a075520 n = a075520_list !! (n-1)
    a075520_list = zipWith (+) a001749_list a039702_list
    -- Reinhard Zumkeller, Feb 20 2012
  • Mathematica
    4#+Mod[#,4]&/@Prime[Range[60]] (* Harvey P. Dale, Mar 10 2016 *)

Formula

a(n) = A001749(n) + A039702(n).

A145989 Run lengths of consecutive primes == 1 (mod 4) where the run length is at least 2.

Original entry on oeis.org

2, 2, 3, 2, 2, 2, 2, 2, 2, 4, 3, 2, 2, 3, 2, 4, 2, 2, 2, 3, 3, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 5, 2, 3, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Enoch Haga, Oct 26 2008

Keywords

Comments

The run lengths of 1's in A039702 are 1, 2, 1, 2, 1, 1, 1, 3,.. as listed in A091318. Deleting all 1's from A091318 generates this sequence here. - R. J. mathar, Sep 30 2011
The maximum run length in the first 1000 terms is 9. - Harvey P. Dale, Jul 27 2025

Examples

			a(1)=2 because this sequence includes consecutive runs of any length and this first occurrence > 1 is a run of 2.
		

References

  • Enoch Haga, Exploring Primes on Your PC and the Internet, 1994-2007. Pp. 30-31. ISBN 978-1-885794-24-6

Crossrefs

Programs

  • Mathematica
    Length/@Select[Split[Table[If[Mod[p,4]==1,1,0],{p,Prime[Range[500]]}]],#[[1]]==1&&Length[#]>1&] (* Harvey P. Dale, Jul 27 2025 *)
  • UBASIC
    10 'cluster primes
    20 C=1
    30 input "end #";L
    40 for N=3 to L step 2
    50 S=int(sqrt(N))
    60 for A=3 to S step 2
    70 B=N/A
    80 if int(B)*A=N then cancel for:goto 170
    90 next A
    100 C=C+1
    110 E=N/4:E=int(E):R=N-(4*E)
    120 if R=1 then print N;:C1=C1+1:T1=T1+1:print T1
    130 if R=3 then T1=0
    140 if R=3 then print " ";N;:C3=C3+1:T2=T2+1:print T2
    150 if R=1 then T2=0
    160 if T1>10 or T2>10 then stop
    170 next
    180 print "Total primes=";C;:print "Type A";C1;"Type B";C3

A145992 Run lengths of 2 or more consecutive primes of the form 4k+3.

Original entry on oeis.org

2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 7, 2, 2, 2, 2, 3, 2, 2, 5, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 5, 5, 2, 2, 4, 2, 2, 3, 2, 2, 3, 4, 2, 2, 3, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 3, 2, 3, 3, 2, 4, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 4, 2, 2, 3, 2, 3, 3, 2, 3, 4, 2, 2, 2, 4, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3
Offset: 1

Views

Author

Enoch Haga, Oct 26 2008

Keywords

Examples

			a(1) = 2 counts the two 3's from A039702(4) to A039702(5).
a(9) = 4 counts the four 3's from A039702(46) to A039702(49).
a(14)= 7 counts the seven 4's from A039702(90) to A039702(96).
		

References

  • Enoch Haga, Exploring Primes on Your PC and the Internet, 1994-2007. Pp. 30-31. ISBN 978-1-885794-24-6

Crossrefs

Programs

  • Maple
    A145992 := proc()
        local m,p,r,i ;
        m := 3 ;
        p := 2 ;
        r := 0 ;
        for i from 2 to 1000 do
            if modp(p,4) = m then
                r := r+1 ;
            else
                if r > 1 then
                    printf("%d,",r) ;
                end if;
                r := 0;
            end if;
            p := nextprime(p) ;
        end do:
    end proc:
    A145992() ; # R. J. Mathar, Aug 29 2018
  • Mathematica
    Most[Length /@ Select[ SplitBy[ Prime@ Range@ 780, Mod[#, 4] &], Mod[#[[1]], 4] == 3 && Length[#] > 1 &]] (* Giovanni Resta, Aug 29 2018 *)
    Length/@Select[Split[Table[If[Mod[n,4]==3,1,0],{n,Prime[Range[ 1000]]}]], FreeQ[ #,0]&]/.(1->Nothing) (* Harvey P. Dale, Jul 27 2020 *)

Extensions

Corrected by R. J. Mathar, Aug 29 2018

A145993 Primes that start a run of at least 2 consecutive primes of the form 4k+3.

Original entry on oeis.org

7, 19, 43, 67, 79, 103, 127, 163, 199, 307, 359, 379, 439, 463, 619, 643, 683, 719, 739, 823, 859, 883, 967, 983, 1087, 1163, 1279, 1303, 1423, 1439, 1459, 1483, 1499, 1559, 1663, 1783, 1811, 1867, 1979, 1999, 2083, 2099, 2179, 2239, 2347, 2399, 2447, 2531, 2579, 2659, 2683, 2699, 2803, 2843, 2879
Offset: 1

Views

Author

Enoch Haga, Oct 26 2008

Keywords

Examples

			a(1)=7 because this sequence includes consecutive runs of any length and this first term >1 in a run of 2 is 7.
		

References

  • Enoch Haga, Exploring Primes on Your PC and the Internet, 1994-2007. Pp. 30-31. ISBN 978-1-885794-24-6

Crossrefs

Programs

  • Maple
    A145993 := proc()
        local m,p,r,i,sp ;
        m := 3 ;
        p := 2 ;
        r := 0 ;
        sp := -1 ;
        for i from 2 to 1000 do
            if modp(p,4) = m then
                r := r+1 ;
                if r = 1 then
                    sp := p ;
                end if;
            else
                if r > 1 then
                    printf("%d,",sp) ;
                end if;
                r := 0;
                sp := -1 ;
            end if;
            p := nextprime(p) ;
        end do:
    end proc:
    A145993() ; # R. J. Mathar, Aug 29 2018
  • Mathematica
    Most[First /@ Select[ SplitBy[ Prime@ Range@ 425, Mod[#, 4] &], Mod[#[[1]], 4] == 3 && Length[#] > 1 &]] (* Giovanni Resta, Aug 29 2018 *)

Extensions

619 inserted by R. J. Mathar, Aug 29 2018

A079950 Triangle of n-th prime modulo twice primes less n-th prime.

Original entry on oeis.org

2, 3, 3, 1, 5, 5, 3, 1, 7, 7, 3, 5, 1, 11, 11, 1, 1, 3, 13, 13, 13, 1, 5, 7, 3, 17, 17, 17, 3, 1, 9, 5, 19, 19, 19, 19, 3, 5, 3, 9, 1, 23, 23, 23, 23, 1, 5, 9, 1, 7, 3, 29, 29, 29, 29, 3, 1, 1, 3, 9, 5, 31, 31, 31, 31, 31, 1, 1, 7, 9, 15, 11, 3, 37, 37, 37, 37, 37, 1, 5, 1, 13, 19, 15, 7, 3, 41
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 19 2003

Keywords

Comments

The right border of the triangle are the primes: T(n,n)=A000040(n); T(n,1)=A039702(n), T(n,2)=A039704(n) for n>1, T(n,3)=A007652(n) for n>2, T(n,4)=A039712(n) for n>3;

Examples

			Triangle begins:
  2;
  3, 3;
  1, 5, 5;
  3, 1, 7,  7;
  3, 5, 1, 11, 11;
  1, 1, 3, 13, 13, 13;
  1, 5, 7,  3, 17, 17, 17;
  ...
		

Crossrefs

Programs

  • Maple
    A079950 := proc(n,k)
        modp(ithprime(n),2*ithprime(k)) ;
    end proc:
    seq(seq(A079950(n,k),k=1..n),n=1..12) ; # R. J. Mathar, Sep 28 2017
  • PARI
    T(n,k) = prime(n) % (2*prime(k));
    tabl(nn) = for (n=1, nn, for (k=1, n, print1(T(n,k), ", ")); print); \\ Michel Marcus, Sep 21 2017

Formula

T(n, k) = prime(n) mod 2*prime(k), 1<=k<=n.

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)

A075518 a(n) = floor(prime(n)/4).

Original entry on oeis.org

0, 0, 1, 1, 2, 3, 4, 4, 5, 7, 7, 9, 10, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 25, 25, 26, 27, 28, 31, 32, 34, 34, 37, 37, 39, 40, 41, 43, 44, 45, 47, 48, 49, 49, 52, 55, 56, 57, 58, 59, 60, 62, 64, 65, 67, 67, 69, 70, 70, 73, 76, 77, 78, 79, 82, 84, 86, 87, 88, 89, 91
Offset: 1

Views

Author

Reinhard Zumkeller, Sep 19 2002

Keywords

Comments

a(n)*4 + A039702(n) = A000040(n).

Crossrefs

Cf. A075519.

Programs

Previous Showing 11-20 of 27 results. Next