A332203
a(n) = 2^(2^n-1) + 1.
Original entry on oeis.org
2, 3, 9, 129, 32769, 2147483649, 9223372036854775809, 170141183460469231731687303715884105729, 57896044618658097711785492504343953926634992332820282019728792003956564819969
Offset: 0
Cf.
A077585 (Double Mersenne numbers: same with -1),
A000225 (Mersenne numbers 2^n-1).
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
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.
-
See Links section.
-
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
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.
-
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 *)
-
a(n) = my(k=1); while (!isprime(k*2^(2^n-1)-1), k++); k; \\ Michel Marcus, May 27 2022
-
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
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
Henrik Lundquist (sploinker(AT)sploink.dk), Mar 30 2006
A290390
Double repunit numbers: repunits with repunit indices.
Original entry on oeis.org
0, 1, 11111111111, 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
Offset: 0
-
Table[Nest[FromDigits@ ConstantArray[1, #] &, n, 2], {n, 0, 3}] (* Michael De Vlieger, Jul 30 2017 *)
-
a002275(n) = (10^n-1)/9
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
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.
Cf.
A000215 (Fermat numbers 2^2^n + 1),
A000225 (Mersenne numbers 2^n - 1).
-
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 *)
-
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
Offset changed to 0 and a(11)-a(14) from
Jinyuan Wang, Feb 26 2020
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
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.
-
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)])
Comments