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

A332203 a(n) = 2^(2^n-1) + 1.

Original entry on oeis.org

2, 3, 9, 129, 32769, 2147483649, 9223372036854775809, 170141183460469231731687303715884105729, 57896044618658097711785492504343953926634992332820282019728792003956564819969
Offset: 0

Views

Author

M. F. Hasler, Mar 05 2020

Keywords

Comments

All terms > 2 are divisible by 3. Moreover, the exponent of the highest power of 3 dividing a(n) behaves like a mixture of 2- and 3-adic ruler function, after the initial 0: (1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 4, ...) = A332202.

Crossrefs

Cf. A077585 (Double Mersenne numbers: same with -1), A000225 (Mersenne numbers 2^n-1).

Programs

  • Mathematica
    a[n_] := 2^(2^n-1) + 1; Array[a,9,0] (* Stefano Spezia, Oct 14 2024 *)
  • PARI
    apply( {A332203(n)=1<<(1<
    				

Formula

a(n) = A000051(A000225(n)) = 2^A000225(n) + 1 = A077585(n) + 2.

A348111 Numbers k whose binary expansion starts with the concatenation of the binary expansions of the run lengths in binary expansion of k.

Original entry on oeis.org

0, 1, 7, 14, 28, 112, 127, 254, 509, 1016, 1018, 1792, 2033, 2037, 2039, 4066, 4072, 4075, 4078, 8132, 8135, 8150, 8156, 16256, 16300, 16313, 32513, 32528, 32576, 32601, 32607, 32626, 32639, 32767, 65027, 65087, 65153, 65202, 65248, 65253, 65255, 65534, 130307
Offset: 1

Views

Author

Rémy Sigrist, Oct 01 2021

Keywords

Comments

We consider here that 0 has an empty binary expansion, and include it in the sequence.
This sequence is infinite as it contains A077585.

Examples

			Regarding 32607:
- the binary expansion of 32607 is "111111101011111",
- the corresponding run lengths are: 7, 1, 1, 1, 5,
- in binary: "111", "1", "1", "1", "101",
- after concatenation: "111111101",
- as "111111101011111" starts with "111111101", 32607 belongs to this sequence.
		

Crossrefs

Programs

  • PARI
    See Links section.
    
  • Python
    from itertools import groupby
    def ok(n):
        if n == 0: return True
        b = bin(n)[2:]
        c = "".join(bin(len(list(g)))[2:] for k, g in groupby(b))
        return b.startswith(c)
    print(list(filter(ok, range(2**17)))) # Michael S. Branicky, Oct 02 2021

A057160 Smallest value of k for which the expression k*2^(2^n-1)-1 is prime.

Original entry on oeis.org

3, 2, 1, 1, 4, 1, 6, 1, 90, 111, 244, 139, 880, 309, 22263, 56083, 130141, 49905
Offset: 0

Views

Author

Steven Harvey, Sep 14 2000

Keywords

Examples

			a(1)=2 because 2*2^(2^1-1)-1 = 2*2^1-1 = 3 which is prime. - _Sean A. Irvine_, May 25 2022
a(4)=4 because 4*2^(2^4-1)-1 = 4*2^15-1 = 4*32768-1 = 131071 which is prime.
		

Crossrefs

Cf. A053989, A058891, A077585 (2^(2^n-1)-1).

Programs

  • Mathematica
    svk[n_]:= Module[{k = 1, c = 2^(2^n-1)}, While[!PrimeQ[k*c-1],k++];k]; Join[{2}, svk /@ Range[17]] (* Harvey P. Dale, Feb 03 2021, adjusted for new offset by Michael De Vlieger, May 25 2022 *)
  • PARI
    a(n) = my(k=1); while (!isprime(k*2^(2^n-1)-1), k++); k; \\ Michel Marcus, May 27 2022
  • Python
    from sympy import isprime
    def a(n):
        k, c = 1, 2**(2**n-1)
        while not isprime(k*c - 1): k += 1
        return k
    print([a(n) for n in range(1, 12)]) # Michael S. Branicky, May 25 2022
    

Formula

a(n) = A053989(A058891(n+1)). - Pontus von Brömssen, May 27 2022

Extensions

Offset and a(1) corrected by Sean A. Irvine, May 25 2022
a(0) prepended by Michel Marcus, May 27 2022

A116961 Numbers of the form 2^(2^k-1)-1, 2^(2^k-1), 2^(2^k)-1, 2^(2^k).

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 8, 15, 16, 127, 128, 255, 256, 32767, 32768, 65535, 65536, 2147483647, 2147483648, 4294967295, 4294967296, 9223372036854775807, 9223372036854775808, 18446744073709551615, 18446744073709551616
Offset: 1

Views

Author

Henrik Lundquist (sploinker(AT)sploink.dk), Mar 30 2006

Keywords

Comments

The values are important in binary computer arithmetic.

Crossrefs

Extensions

Edited by Don Reble, Mar 31 2006

A290390 Double repunit numbers: repunits with repunit indices.

Original entry on oeis.org

0, 1, 11111111111, 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
Offset: 0

Views

Author

Felix Fröhlich, Jul 29 2017

Keywords

Comments

a(3) has 111 digits.
As in the case of A077585, where a necessary condition for a term to be prime is that its index is a Mersenne prime, a necessary (but not sufficient) condition for a term of this sequence to be prime is that the number of ones is a repunit prime, i.e., A055642(a(n)) must be a term of A004022.
Are there any primes in this sequence? In other words, is there a term of A004022 that is also a term of A004023?
Second sequence in the hierarchy of sequences obtained by successive numbers of nestings of the form A002275(...A002275(n)...). All higher order sequences in this hierarchy grow much too fast to be included in the OEIS.

Crossrefs

Programs

  • Mathematica
    Table[Nest[FromDigits@ ConstantArray[1, #] &, n, 2], {n, 0, 3}] (* Michael De Vlieger, Jul 30 2017 *)
  • PARI
    a002275(n) = (10^n-1)/9
    a(n) = a002275(a002275(n))

Formula

a(n) = A002275(A002275(n)).

A332847 a(n) is the smallest k such that exactly one of k*2^(2^n) - 2*k + 1 and k*2^(2^n) + 2*k - 1 is a prime.

Original entry on oeis.org

1, 4, 1, 1, 1, 3, 3, 10, 17, 8, 83, 92, 525, 1888, 20, 6804, 11390
Offset: 0

Views

Author

Juri-Stepan Gerasimov, Feb 26 2020

Keywords

Comments

Conjecture: a(n) > 1 for all n > 4.
a(n) = 1, n > 1, is equivalent to F(n) = 2^(2^n) + 1 being a Fermat prime, because the Mersenne number M(2^n) = 2^(2^n) - 1 is prime only for n = 1 (since divisible by 3 for all n >= 1), where F(1) is also prime. - The two considered numbers can also be written 2*k*A077585(n) + 1 resp. 2*k*A000051(A000225(n)) - 1. - M. F. Hasler, Mar 05 2020

Examples

			a(0) = 1 because 1*2^(2^0) - 2*1 + 1 = 1 is a nonprime and 1*2^(2^0) + 2*1 - 1 = 3 is a prime.
a(1) = 4 because 4*2^(2^1) - 2*4 + 1 = 9 is a composite and 4*2^(2^1) + 2*4 - 1 = 23 is a prime.
a(2) = 1 because 1*2^(2^2) - 2*1 + 1 = 15 is a composite and 1*2^(2^2) + 2*1 - 1 = 17 is a prime.
a(3) = 1 because 1*2^(2^3) - 2*1 + 1 = 255 is a composite and 1*2^(2^3) + 2*1 - 1 = 257 is a prime.
a(4) = 1 because 1*2^(2^4) - 2*1 + 1 = 65535 is a composite and 1*2^(2^4) + 2*1 - 1 = 65537 is a prime.
		

Crossrefs

Cf. A000215 (Fermat numbers 2^2^n + 1), A000225 (Mersenne numbers 2^n - 1).

Programs

  • Mathematica
    Table[Module[{k=1},While[Total[Boole[PrimeQ[k*2^(2^n)+{2k-1,-2k+1}]]]!=1,k++];k],{n,0,14}] (* Harvey P. Dale, Jun 03 2025 *)
  • PARI
    a(n) = {my(k=1, m=2^2^n); while(ispseudoprime(k*m-2*k+1)-ispseudoprime(k*m+2*k-1)==0, k++); k; } \\ Jinyuan Wang, Feb 26 2020

Extensions

Offset changed to 0 and a(11)-a(14) from Jinyuan Wang, Feb 26 2020
a(15)-a(16) from Michael S. Branicky, Jun 16 2025

A376613 The binary expansion of a(n) tracks where the merge operations occurs in a Tim sort algorithm applied to n blocks.

Original entry on oeis.org

0, 1, 5, 7, 53, 61, 119, 127, 1973, 2037, 4029, 4093, 16247, 16375, 32639, 32767, 1046453, 1048501, 2095093, 2097141, 8384445, 8388541, 16773117, 16777213, 134201207, 134217591, 268419063, 268435447, 1073708927, 1073741695, 2147450879, 2147483647, 137437902773
Offset: 1

Views

Author

Darío Clavijo, Sep 29 2024

Keywords

Comments

Initial blocks for the Tim sort merges are usually found by checking for existing ordered runs, or insertion sort on a small number of elements; then here a(n) is how the merges proceed for n blocks.
Each adjacent pair of blocks are merged, and if the number of blocks is odd then one block is left unchanged; then repeat that process until just 1 block remains.
Each merge performed is encoded as a 1 bit, and a block left unchanged is encoded as a 0 bit.
The total number of 1 bits in a(n) is n-1, since each merge reduces the number of blocks by 1. In other words, A000120(a(n)) = n - 1.
The bitsize of a(n) is A233272(n)-1.

Examples

			For n = 10 a(10) = 2037 because:
Size | Block pair (l,m)(m,r) to merge | Left over block  | Encoding
-----+--------------------------------+------------------+-----------
   1 | ((0, 0), (0, 1))               |                  | 1
   1 | ((2, 2), (2, 3))               |                  | 11
   1 | ((4, 4), (4, 5))               |                  | 111
   1 | ((6, 6), (6, 7))               |                  | 1111
   1 | ((8, 8), (8, 9))               |                  | 11111
   2 | ((0, 1), (1, 3))               |                  | 111111
   2 | ((4, 5), (5, 7))               |                  | 1111111
   2 |                                | ((8, 9), (9, 9)) | 11111110
   4 | ((0, 3), (3, 7))               |                  | 111111101
   4 |                                | ((8, 9), (9, 9)) | 1111111010
   8 | ((0, 7), (7, 9))               |                  | 11111110101
11111110101 in base 10 is 2037.
For n=10, the merges performed on 1,...,10 begin with pairs of "blocks" of length 1 each,
  1  2  3  4  5  6  7  8  9  10
  \--/  \--/  \--/  \--/  \---/
   1     1     1     1      1    encoding
  [1 2] [3 4] [5 6] [7 8] [9 10]
  \---------/ \---------/
       1           1        0    encoding
Similarly on the resulting 3 blocks
  [1 2 3 4] [5 6 7 8] [9 10]
  \-----------------/
          1             0        encoding
Then a merge of the resulting 2 blocks to a single sorted block.
  [1 2 3 4 5 6 7 8] [9 10]
  \----------------------/
            1                    encoding
These encodings are then a(10) = binary 11111 110 10 1 = 2037.
		

Crossrefs

Programs

  • Python
    def a(n):
        if n == 1: return 0
        s, t, n1 = 1, 0, (n - 1)
        while s < n:
            d = s << 1
            for l in range(0, n, d):
                m,r = min(l - 1 + s, n1), min(l - 1 + d, n1)
                t = (t << 1) + int(m < r)
            s = d
        return t
    print([a(n) for n in range (1,22)])

Formula

a(2^k) = A077585(k).
Previous Showing 11-17 of 17 results.