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 21-30 of 34 results. Next

A372686 Sorted list of positions of first appearances in A014499 (number of ones in binary expansion of each prime).

Original entry on oeis.org

1, 2, 4, 9, 11, 31, 64, 76, 167, 309, 502, 801, 1028, 6363, 7281, 12079, 12251, 43237, 43390, 146605, 291640, 951351, 1046198, 2063216, 3957778, 11134645, 14198321, 28186247, 54387475, 105097565, 249939829, 393248783, 751545789, 1391572698, 2182112798, 8242984130
Offset: 1

Views

Author

Gus Wiseman, May 14 2024

Keywords

Comments

The unsorted version is A372517.

Examples

			The sequence contains 9 because the first 9 terms of A014499 are 1, 2, 2, 3, 3, 3, 2, 3, 4, and the last of these is the first position of 4.
		

Crossrefs

Positions of first appearances in A014499.
The unsorted version is A372517.
For binary length we have A372684, primes A104080, firsts of A035100.
Taking primes gives A372685, unsorted version A061712.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A029837 gives greatest binary index, least A001511.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of each prime, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives length of binary expansion (number of bits).
A372471 lists binary indices of primes.

Programs

  • Mathematica
    First/@GatherBy[Range[1000],DigitCount[Prime[#],2,1]&]

Formula

prime(a(n)) = A372685(n).

Extensions

a(26)-a(36) from Pontus von Brömssen, May 15 2024

A104081 Smallest prime >= 3^n.

Original entry on oeis.org

2, 3, 11, 29, 83, 251, 733, 2203, 6563, 19687, 59051, 177167, 531457, 1594331, 4782971, 14348909, 43046747, 129140197, 387420499, 1162261523, 3486784409, 10460353259, 31381059613, 94143178859, 282429536483, 847288609457
Offset: 0

Views

Author

Cino Hilliard, Mar 03 2005

Keywords

Crossrefs

Cf. A104080 (for 2^n).
Cf. A104088 (largest prime <= 3^n).

Programs

Formula

a(n) = A014211(n), n > 1. - R. J. Mathar, Dec 13 2008
a(n) = A007918(A000244(n)). - Michel Marcus, Nov 08 2018

A372538 Numbers k such that the number of ones minus the number of zeros in the binary expansion of the k-th prime number is 1.

Original entry on oeis.org

3, 8, 20, 23, 24, 26, 30, 58, 61, 63, 65, 67, 78, 80, 81, 82, 84, 88, 185, 187, 194, 200, 201, 203, 213, 214, 215, 221, 225, 226, 227, 234, 237, 246, 249, 253, 255, 256, 257, 259, 266, 270, 280, 284, 287, 290, 573, 578, 586, 588, 591, 593, 611, 614, 615, 626
Offset: 1

Views

Author

Gus Wiseman, May 13 2024

Keywords

Examples

			The binary expansion of 83 is (1,0,1,0,0,1,1) with ones minus zeros 4 - 3 = 1, and 83 is the 23rd prime, so 23 is in the sequence.
The primes A000040(a(n)) together with their binary expansions and binary indices begin:
     5:           101 ~ {1,3}
    19:         10011 ~ {1,2,5}
    71:       1000111 ~ {1,2,3,7}
    83:       1010011 ~ {1,2,5,7}
    89:       1011001 ~ {1,4,5,7}
   101:       1100101 ~ {1,3,6,7}
   113:       1110001 ~ {1,5,6,7}
   271:     100001111 ~ {1,2,3,4,9}
   283:     100011011 ~ {1,2,4,5,9}
   307:     100110011 ~ {1,2,5,6,9}
   313:     100111001 ~ {1,4,5,6,9}
   331:     101001011 ~ {1,2,4,7,9}
   397:     110001101 ~ {1,3,4,8,9}
   409:     110011001 ~ {1,4,5,8,9}
   419:     110100011 ~ {1,2,6,8,9}
   421:     110100101 ~ {1,3,6,8,9}
   433:     110110001 ~ {1,5,6,8,9}
   457:     111001001 ~ {1,4,7,8,9}
  1103:   10001001111 ~ {1,2,3,4,7,11}
  1117:   10001011101 ~ {1,3,4,5,7,11}
  1181:   10010011101 ~ {1,3,4,5,8,11}
  1223:   10011000111 ~ {1,2,3,7,8,11}
		

Crossrefs

Restriction of A031448 to the primes, positions of ones in A145037.
Taking primes gives A095073, negative A095072.
Positions of ones in A372516, absolute value A177718.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives the length of an integer's binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    Select[Range[1000],DigitCount[Prime[#],2,1]-DigitCount[Prime[#],2,0]==1&]

A372539 Numbers k such that the number of ones minus the number of zeros in the binary expansion of the k-th prime number is -1.

Original entry on oeis.org

7, 19, 21, 25, 56, 57, 59, 60, 62, 68, 71, 77, 79, 87, 175, 177, 179, 180, 186, 188, 189, 192, 193, 195, 196, 197, 204, 210, 212, 216, 218, 243, 244, 248, 254, 262, 263, 265, 279, 567, 572, 576, 577, 583, 592, 598, 599, 600, 602, 603, 605, 606, 610, 613, 616
Offset: 1

Views

Author

Gus Wiseman, May 14 2024

Keywords

Examples

			The binary expansion of 17 is (1,0,0,0,1) with ones minus zeros 2 - 3 = -1, and 17 is the 7th prime, 7 is in the sequence.
The primes A000040(a(n)) together with their binary expansions and binary indices begin:
    17:         10001 ~ {1,5}
    67:       1000011 ~ {1,2,7}
    73:       1001001 ~ {1,4,7}
    97:       1100001 ~ {1,6,7}
   263:     100000111 ~ {1,2,3,9}
   269:     100001101 ~ {1,3,4,9}
   277:     100010101 ~ {1,3,5,9}
   281:     100011001 ~ {1,4,5,9}
   293:     100100101 ~ {1,3,6,9}
   337:     101010001 ~ {1,5,7,9}
   353:     101100001 ~ {1,6,7,9}
   389:     110000101 ~ {1,3,8,9}
   401:     110010001 ~ {1,5,8,9}
   449:     111000001 ~ {1,7,8,9}
  1039:   10000001111 ~ {1,2,3,4,11}
  1051:   10000011011 ~ {1,2,4,5,11}
  1063:   10000100111 ~ {1,2,3,6,11}
  1069:   10000101101 ~ {1,3,4,6,11}
  1109:   10001010101 ~ {1,3,5,7,11}
  1123:   10001100011 ~ {1,2,6,7,11}
  1129:   10001101001 ~ {1,4,6,7,11}
  1163:   10010001011 ~ {1,2,4,8,11}
		

Crossrefs

Restriction of A031444 (positions of '-1's in A145037) to A000040.
Taking primes gives A095072.
Positions of negative ones in A372516, absolute value A177718.
The negative version is A372538, taking primes A095073.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A070939 gives the length of an integer's binary expansion.
A101211 lists run-lengths in binary expansion, row-lengths A069010.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    Select[Range[1000],DigitCount[Prime[#],2,1]-DigitCount[Prime[#],2,0]==-1&]

A372685 Prime numbers such that no lesser prime has the same binary weight (number of ones in binary expansion).

Original entry on oeis.org

2, 3, 7, 23, 31, 127, 311, 383, 991, 2039, 3583, 6143, 8191, 63487, 73727, 129023, 131071, 522239, 524287, 1966079, 4128767, 14680063, 16250879, 33546239, 67108351, 201064447, 260046847, 536739839, 1073479679, 2147483647, 5335154687, 8581545983, 16911433727
Offset: 1

Views

Author

Gus Wiseman, May 10 2024

Keywords

Comments

The unsorted version is A061712.

Examples

			The terms together with their binary expansions and binary indices begin:
     2:            10 ~ {2}
     3:            11 ~ {1,2}
     7:           111 ~ {1,2,3}
    23:         10111 ~ {1,2,3,5}
    31:         11111 ~ {1,2,3,4,5}
   127:       1111111 ~ {1,2,3,4,5,6,7}
   311:     100110111 ~ {1,2,3,5,6,9}
   383:     101111111 ~ {1,2,3,4,5,6,7,9}
   991:    1111011111 ~ {1,2,3,4,5,7,8,9,10}
  2039:   11111110111 ~ {1,2,3,5,6,7,8,9,10,11}
  3583:  110111111111 ~ {1,2,3,4,5,6,7,8,9,11,12}
  6143: 1011111111111 ~ {1,2,3,4,5,6,7,8,9,10,11,13}
		

Crossrefs

This statistic (binary weight of primes) is A014499.
Sorted version of A061712.
For binary length instead of weight we have A104080, firsts of A035100.
These primes have indices A372686, sorted version of A372517.
A000120 counts ones in binary expansion (binary weight), zeros A080791.
A029837 gives greatest binary index, least A001511.
A030190 gives binary expansion, reversed A030308.
A035103 counts zeros in binary expansion of primes, firsts A372474.
A048793 lists binary indices, reverse A272020, sum A029931.
A372471 lists binary indices of primes.

Programs

  • Mathematica
    First/@GatherBy[Select[Range[1000],PrimeQ],DigitCount[#,2,1]&]
  • Python
    from itertools import islice
    from sympy import nextprime
    def A372685_gen(): # generator of terms
        p, a = 1, {}
        while (p:=nextprime(p)):
            if (c:=p.bit_count()) not in a:
                yield p
            a[c] = p
    A372685_list = list(islice(A372685_gen(),20)) # Chai Wah Wu, May 12 2024

Formula

a(n) = prime(A372686(n)).

Extensions

a(22)-a(33) from Chai Wah Wu, May 12 2024

A168157 Number of 0's in the matrix whose lines are the binary expansion of the first n primes.

Original entry on oeis.org

1, 1, 4, 4, 9, 10, 19, 21, 22, 23, 23, 37, 40, 42, 43, 45, 46, 47, 69, 72, 76, 78, 81, 84, 88, 91, 93, 95, 97, 100, 100, 136, 141, 145, 149, 152, 155, 159, 162, 165, 168, 171, 172, 177, 181, 184, 187, 188, 191, 194, 197, 198, 201, 202, 263, 268, 273, 277, 282, 287
Offset: 1

Views

Author

M. F. Hasler, Nov 21 2009

Keywords

Comments

The matrix is to be taken of minimal size, i.e., have n lines and the number of columns needed to write the n-th prime in the last line, A035100(n). Otherwise said, there is no zero column except for n=1 (prime(1) = 2 = 10[2] in binary).
The number of zeros in the last line of the matrix is given by A035103(n).
One has a(n)=a(n-1) iff n = A059305(k) for some k, i.e. prime(n) is a Mersenne prime A000668(k) = A000225(A000043(k)).
If prime(n)=2^2^k+1 is a Fermat prime (A019434), n>2, then one has a(n)=a(n-1)+n-1+2^k-1.
More generally, the "big jumps" a(n+1) > a(n)+n happen whenever a column is added, i.e. when prime(n) = A014234(k) <=> prime(n+1) = A104080(k) for some k,n>1.

Examples

			a(4)=4 is the number of zeros in the matrix [010] /* = 2 in binary */ [011] /* = 3 in binary */ [101] /* = 5 in binary */ [111] /* = 7 in binary */
		

Programs

  • PARI
    A168157(n)=n*#binary(prime(n))-sum(i=1,n,norml2(binary(prime(i))))

Formula

a(n)=n*A035100(n)-A095375(n).

A250396 a(n) is the smallest prime greater than 2^n such that 2 is a primitive root modulo a(n).

Original entry on oeis.org

3, 3, 5, 11, 19, 37, 67, 131, 269, 523, 1061, 2053, 4099, 8219, 16421, 32771, 65539, 131213, 262147, 524309, 1048589, 2097211, 4194371, 8388619, 16777259, 33554467, 67108933, 134217773, 268435459, 536871019, 1073741827, 2147483659, 4294967357, 8589934621, 17179869269, 34359738421, 68719476851, 137438953741
Offset: 0

Views

Author

Morgan L. Owens, Nov 21 2014

Keywords

References

  • Henri Cohen, A Course in Computational Algebraic Number Theory, Springer Verlag, (1993)

Crossrefs

Cf. A104080 (smallest prime >= 2^n).

Programs

  • Mathematica
    With[{n = 20},
    Module[{p = NextPrime[2^n]},
      While[FreeQ[PrimitiveRootList[p], 2], p = NextPrime[p]]; p]]
  • PARI
    a(n)=forprime(p=2^n+1,,if(znorder(Mod(2,p))==p-1,return(p))); \\ Joerg Arndt, Nov 21 2014

A298817 a(n) is the binary XOR of all n-bit prime numbers.

Original entry on oeis.org

0, 1, 2, 6, 23, 59, 99, 203, 469, 807, 1615, 3349, 2266, 4576, 14042, 25002, 89193, 131215, 135904, 814531, 885682, 60842, 3969154, 3370892, 6742296, 14350136, 42766902, 97565102, 444197631, 515121776, 2085329975, 2091732354, 7999937231, 14794305847
Offset: 1

Views

Author

Alex Ratushnyak, Jan 26 2018

Keywords

Comments

XOR is the binary exclusive-or operator.
a(1)=0 for compatibility with similar sequences, and because 0 and 1 are not primes.
Note the sequence s(n)-a(n), where s(n)=A298816(n) is the binary XOR of all n-bit squares, begins: 1, -1, 2, 3, -14, -38, -87, -175, -20, -230, -1258, -2352, 3819, 9957, -1525, -9925, 31932, 21654, 264124, 226521, 405022, 2495526, 944510, 8579700, 15679080, 49342536, -35092149, -19209773, -131473914. The distribution of negative and positive terms does not look random: runs of negative terms are followed by runs of positive terms.

Examples

			There are two 4-bit primes, namely 11 and 13.  a(4) = (11 XOR 13) = 6.
		

Crossrefs

Programs

  • PARI
    a(n) = {my(x = 0); for (k=2^(n-1), 2^n-1, if (isprime(k), x = bitxor(x, k));); x;} \\ Michel Marcus, Jan 27 2018
  • Python
    from sympy import nextprime
    n = x = L = 2
    print('0', end=',')
    while L < 27:
        nextn = nextprime(n)
        if (nextn ^ n) > n:  # if lengths of binary representations are different
            print(str(x), end=',')
            x = 0
            prevL = L
            L = len(bin(nextn))-2
            for j in range(prevL, L-1):  print('0', end=',')
        n = nextn
        x ^= n
    

Extensions

a(30)-a(34) from Lars Blomberg, Nov 10 2018

A338475 Decimal expansion of the sum of reciprocals of the smallest primes > 2^k for k >= 0.

Original entry on oeis.org

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

Views

Author

Bernard Schott, Oct 29 2020

Keywords

Comments

If q(k) = A014210(k) is the smallest prime > 2^k, then 2^k < q(k), so Sum_{k>=0} 1/q(k) < Sum_{k>=0} 1/2^k = 2; hence, the sum of the reciprocals of these primes q(k) form a convergent series.

Examples

			1.2404071466559606289464180214057283392313810734691...
		

References

  • J.-M. De Koninck & A. Mercier, 1001 Problèmes en Théorie Classique des Nombres, Problème 615 pp. 82 and 279, Ellipses, Paris, 2004. Warning : gives Sum_{k>=1} 1/A104080(k) = 0.7404...

Crossrefs

Programs

  • Maple
    evalf(sum(1/nextprime(2^k), k=0..infinity),90);
  • Mathematica
    ndigits = 90; RealDigits[Sum[1/NextPrime[2^k], {k, 0, ndigits/Log10[2] + 1}], 10, ndigits][[1]] (* Amiram Eldar, Oct 29 2020 *)
  • PARI
    suminf(k=0, 1/nextprime(2^k+1)) \\ Michel Marcus, Oct 29 2020

Formula

Equals Sum_{k>=0} 1/A014210(k).

A352942 Let p = prime(n); a(n) = number of primes q with same number of binary digits as p that can be obtained from p by changing one binary digit.

Original entry on oeis.org

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

Views

Author

Michael S. Branicky, May 11 2022

Keywords

Comments

a(n) is also the degree of prime(n) in the graph P(A070939(prime(n)), 2), defined in A145667.

Examples

			prime(1) = 2, in binary 10, has one neighbor 11 in P(2, 2), so a(1) = 1.
prime(14) = 43, in binary 101011, has neighbors 101001 (41), 101111 (47), 111011 (59), so a(14) = 3.
		

Crossrefs

Programs

  • Maple
    a:= n-> (p-> nops(select(isprime, {seq(Bits[Xor]
            (p, 2^i), i=0..ilog2(p)-1)})))(ithprime(n)):
    seq(a(n), n=1..100);  # Alois P. Heinz, May 11 2022
  • Mathematica
    A352942[n_] := Count[BitXor[#, 2^Range[0, BitLength[#] - 2]], _?PrimeQ] & [Prime[n]];
    Array[A352942, 100] (* Paolo Xausa, Apr 23 2025 *)
  • Python
    from sympy import isprime, sieve
    def neighs(s):
        digs = "01"
        ham1 = (s[:i]+d+s[i+1:] for i in range(len(s)) for d in digs if d!=s[i])
        yield from (h for h in ham1 if h[0] != '0')
    def a(n):
        return sum(1 for s in neighs(bin(sieve[n])[2:]) if isprime(int(s, 2)))
    print([a(n) for n in range(1, 88)])

Formula

a(n) = deg(prime(n)) in P(A070939(prime(n)), 2) (see A145667).
Previous Showing 21-30 of 34 results. Next