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

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

A091318 Lengths of runs of 1's in A039702.

Original entry on oeis.org

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

Views

Author

Enoch Haga, Feb 22 2004

Keywords

Comments

Number of primes congruent to 1 mod 4 in sequence before interruption by a prime 3 mod 4.

Examples

			a(8)=3 because this is the sequence of primes congruent to 1 mod 4: 89, 97, 101. The next prime is 103, a prime 3 mod 4.
		

References

  • Enoch Haga, Exploring prime numbers on your PC and the Internet with directions to prime number sites on the Internet, 2001, pages 30-31. ISBN 1-885794-17-7.

Crossrefs

Programs

  • Mathematica
    t = Length /@ Split[Table[Mod[Prime[n], 4], {n, 2, 400}]]; Most[Transpose[Partition[t, 2]][[2]]] (* T. D. Noe, Sep 21 2012 *)

Formula

Count primes congruent to 1 mod 4 in sequence before interruption by a prime divided by 4 with remainder 3.

A091267 Lengths of runs of 3's in A039702.

Original entry on oeis.org

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

Views

Author

Enoch Haga, Feb 22 2004

Keywords

Comments

Number of primes congruent to 3 mod 4 in sequence before interruption by a prime 1 mod 4.

Examples

			a(16)=4 because this is the sequence of primes congruent to 3 mod 4: 199, 211, 223, 227. The next prime is 229, a prime 1 mod 4.
		

References

  • Enoch Haga, Exploring prime numbers on your PC and the Internet with directions to prime number sites on the Internet, 2001, pages 30-31. ISBN 1-885794-17-7.

Crossrefs

Programs

  • Mathematica
    t = Length /@ Split[Table[Mod[Prime[n], 4], {n, 2, 400}]]; Most[Transpose[Partition[t, 2]][[1]]] (* T. D. Noe, Sep 21 2012 *)

Formula

Count primes congruent to 3 mod 4 in sequence before interruption by a prime divided by 4 with remainder 1.

A379783 For n >= 2, let b(n) = 1 if A379899(n) is 3 mod 4, 0 if A379899(n) is 1 mod 4; form the RUNS transform of {b(n), n >= 2}.

Original entry on oeis.org

3, 7, 19, 42, 116, 292, 791, 2085, 5692, 15482, 42709, 118272, 329891, 923905, 2600458, 7344965, 20818129
Offset: 1

Views

Author

N. J. A. Sloane, Jan 11 2025

Keywords

Comments

If instead of A379899 we begin with the primes >= 2 in their natural order, the {b(n), n >= 2} sequence is 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, ..., with RUNS transform 1, 1, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 2, 3, 2, ..., (a dramatically different sequence, essentially A091237).

Examples

			A379899 begins 2, 3, 7, 11, 5, 13, 17, 29, 37, 41, 53, 19, ..., and the {b(n), n >= 2} sequence begins 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, ..., whose RUNS transform is 3, 7, 19, 42, ...
		

Crossrefs

See also A379652, A379785.

Programs

  • Mathematica
    nn = 2^20; c[_] := True; j = 3; q = 0; r = 1; s = 4;
    Monitor[Reap[
      Do[m = j + s;
        While[k = SelectFirst[FactorInteger[m][[All, 1]], c]; !IntegerQ[k],
          m += s];
        c[k] = False; j = k;
        If[# == r, q++, r = #; Sow[q]; q = 1] &[(Mod[k, 4] - 1)/2],
    {n, nn}] ][[-1, 1]], n] (* Michael De Vlieger, Jan 11 2025 *)

Extensions

a(10)-a(17) from Michael De Vlieger, Jan 11 2025

A380130 For n >= 2, let b(n) = 1 if A379784(n) is 3 mod 4, 0 if A379784(n) is 1 mod 4; form the RUNS transform of {b(n), n >= 2}.

Original entry on oeis.org

1, 6, 13, 34, 87, 229, 581, 1591, 4268, 11637, 31944, 88526, 246105, 688982, 1936129, 5463517, 15470445
Offset: 1

Views

Author

Robert C. Lyons, Jan 12 2025

Keywords

Examples

			A379784 begins 1, 5, 3, 7, 11, 19, 23, 31, 13, 17, 29, 37, ..., and the {b(n), n >= 2} sequence begins 0, 1, 1, 1, 1, 1, 1, 0, ..., whose RUNS transform is 1, 6, ...
		

Crossrefs

Programs

  • Mathematica
    nn = 2^19; c[_] := True; q = 0; j = r = 1; s = 4;
    Monitor[Rest@ Reap[Do[m = j + s;
      While[Set[k, SelectFirst[FactorInteger[m][[All, 1]], c]];
        ! IntegerQ[k], m += s];
      c[k] = False; j = k;
      If[# == r, q++, r = #; Sow[q]; q = 1] &[(Mod[k, 4] - 1)/2],
    {n, nn}] ][[-1, 1]], n] (* Michael De Vlieger, Jan 13 2025 *)
  • Python
    from sympy import primefactors
    prev_a379784 = 1
    prev_b = -1
    b_run = 0
    a379784_set = set([prev_a379784])
    seq = []
    max_seq_len = 17
    while len(seq) < max_seq_len:
        c = prev_a379784
        done = False
        while not done:
            c = c + 4
            factors = primefactors(c)
            for factor in factors:
                if factor not in a379784_set:
                    a379784_set.add(factor)
                    if factor % 4 == 3:
                        b = 1
                    else:
                        b = 0
                    if prev_b >= 0:
                        if b == prev_b:
                            b_run += 1
                        else:
                            seq.append(b_run)
                            b_run = 1
                    else:
                        b_run = 1
                    prev_b = b
                    prev_a379784 = factor
                    done = True
                    break
    print(seq)
Showing 1-5 of 5 results.