Gennady Eremin has authored 7 sequences.
Original entry on oeis.org
3, 5, 7, 11, 13, 19, 23, 29, 31, 43, 47, 53, 59, 61, 71, 79, 83, 103, 107, 109, 127, 151, 157, 167, 173, 179, 181, 191, 199, 211, 223, 239, 251, 271, 283, 307, 311, 317, 331, 347, 349, 359, 367, 373, 379, 383, 431, 439, 443, 461, 463, 467, 479, 487, 491, 499
Offset: 1
-
q:= proc(n) local l, t, i; l:= Bits[Split](n); t:=0;
for i to nops(l) do t:= t-1+2*l[i];
if t<0 then return false fi
od: true
end:
select(isprime and q, [$2..500])[]; # Alois P. Heinz, Jan 07 2022
-
q[n_] := PrimeQ[n] && AllTrue[Accumulate[(-1)^Reverse[IntegerDigits[n, 2]]], # <= 0 &]; Select[Range[500], q] (* Amiram Eldar, Jan 07 2022 *)
-
from sympy import isprime
def ok(n):
if n == 0: return True
count = {"0": 0, "1": 0}
for bit in bin(n)[:1:-1]:
count[bit] += 1
if count["0"] > count["1"]: return False
return isprime(n)
print([k for k in range(3, 500, 2) if ok(k)]) # Michael S. Branicky, Jan 07 2022
A350346
Binary numbers such that when read from right to left, the number of 0's never exceeds the number of 1's.
Original entry on oeis.org
0, 1, 11, 101, 111, 1011, 1101, 1111, 10011, 10101, 10111, 11011, 11101, 11111, 100111, 101011, 101101, 101111, 110011, 110101, 110111, 111011, 111101, 111111, 1000111, 1001011, 1001101, 1001111, 1010011, 1010101, 1010111, 1011011, 1011101, 1011111, 1100111
Offset: 1
s -> ss -> 0s1s -> 00s11s -> 000111s -> 00011101 = 11101.
- Gennady Eremin, Table of n, a(n) for n = 1..5000
- Gennady Eremin, Dyck Numbers, III. Enumeration and bijection with symmetric Dyck paths, arXiv:2302.02765 [math.CO], 2023.
- Gennady Eremin, Dyck Numbers, IV. Nested patterns in OEIS A036991, arXiv:2306.10318, 2023.
-
Join[{0},Select[Table[FromDigits[IntegerDigits[n,2]],{n,120}],Min[Accumulate[ Reverse[ IntegerDigits[#]]/.(0->-1)]]>=0&]] (* Harvey P. Dale, Apr 29 2022 *)
-
def ok(n):
if n == 0: return True
count = {"0": 0, "1": 0}
for bit in bin(n)[:1:-1]:
count[bit] += 1
if count["0"] > count["1"]: return False
return True # A036991
nn = 1; print(1, 0)
for n in range(1, 23230): # printing b-file
if ok(n) == False: continue
nn += 1; print(nn, bin(n)[2:])
-
from itertools import count, islice
def A350346_gen(): # generator of terms
yield 0
for n in count(1):
s = bin(n)[2:]
c, l = 0, len(s)
for i in range(l):
c += int(s[l-i-1])
if 2*c <= i:
break
else:
yield int(s)
A350346_list = list(islice(A350346_gen(),20)) # Chai Wah Wu, Dec 30 2021
A343773
Excess of the number of even Motzkin n-paths (A107587) over the odd ones (A343386).
Original entry on oeis.org
1, 1, 0, -2, -3, 1, 11, 15, -13, -77, -86, 144, 595, 495, -1520, -4810, -2485, 15675, 39560, 6290, -159105, -324805, 87075, 1592843, 2616757, -2136539, -15726114, -20247800, 32296693, 152909577, 145139491, -417959049, -1460704685, -885536173, 4997618808, 13658704994
Offset: 0
G.f. = 1 + x - 2*x^3 - 3*x^4 + x^5 + 11*x^6 + 15*x^7 - 13*x^8 - 77*x^9 - 86*x^10 + 144*x^11 + ...
-
With[{$MaxExtraPrecision = 1000}, CoefficientList[Series[(-1 + x + Sqrt[1 - 2 x + 5 x^2])/(2 x^2), {x, 0, 36}], x] ] (* Michael De Vlieger, May 01 2021 *)
a[n_] := Hypergeometric2F1[(1 - n)/2, -n/2, 2, -4];
Table[a[n], {n, 0, 35}] (* Peter Luschny, May 30 2021 *)
a[ n_] := If[n<0, 0, SeriesCoefficient[Nest[1 + x*# - (x*#)^2&, 1 + O[x], n], {x, 0, n}]]; (* Michael Somos, Oct 27 2024 *)
a[ n_] := SeriesCoefficient[2/(1 - x + (1 - 2*x + 5*x^2)^(1/2)), {x, 0, n}]; (* Michael Somos, Oct 27 2024 *)
-
{a(n) = my(y = 1 + O(x)); for(i = 1, n, y = 1 + x*y - x^2*y^2); polcoeff(y, n)}; /* Michael Somos, Oct 27 2024 */
-
{a(n) = polcoeff( 2/(1 - x + (1 - 2*x + 5*x^2 + x*O(x^n))^(1/2)), n)}; /* Michael Somos, Oct 27 2024 */
-
A343773 = [1, 1]
for n in range(2, 801):
A343773.append(((2*n+1)*A343773[-1]
- 5*(n-1)*A343773[-2]) // (n+2))
A343386
Number of odd Motzkin n-paths, i.e., Motzkin n-paths with an odd number of up steps.
Original entry on oeis.org
0, 0, 1, 3, 6, 10, 20, 56, 168, 456, 1137, 2827, 7458, 20670, 57577, 157691, 427976, 1170552, 3248411, 9096497, 25505562, 71436182, 200338074, 564083786, 1595055520, 4522769520, 12842772295, 36514010301, 103995490758, 296794937626, 848620165860, 2430089817720
Offset: 0
G.f. = x^2 + 3*x^3 + 6*x^4 + 10*x^5 + 20*x^6 + 56*x^7 + 168*x^8 + ...
-
a[n_] := ((n - 1) n HypergeometricPFQ[{1/2 - n/4, 3/4 - n/4, 1 - n/4, 5/4 - n/4}, {3/2, 3/2, 2}, 16])/2;
Table[a[n], {n, 0, 31}] (* Peter Luschny, Sep 24 2021 *)
-
M = [4, 9]; E = [1, 1, 1, 1, 3];
A343386 = [0, 0, 1, 3, 6]
for n in range(5, 801):
M.append(((2*n+1)*M[1]+(3*n-3)*M[0])//(n+2))
E.append(((5*n**2+n-3)*E[4] - (10*n**2-16*n+3)*E[3]
+ (10*n**2-34*n+27)*E[2] + (11*n-5)*(n-3)*E[1]
- 15*(n-3)*(n-4)*E[0]) // (n*n+2*n))
A343386.append(M[-1] - E[-1])
M.pop(0); E.pop(0)
A340544
Numbers from A340131 that are not multiples of 3.
Original entry on oeis.org
5, 11, 29, 44, 50, 83, 98, 104, 116, 128, 140, 146, 245, 260, 266, 278, 290, 302, 308, 332, 344, 377, 380, 395, 401, 410, 416, 434, 449, 455, 731, 746, 752, 764, 776, 788, 794, 818, 830, 863, 866, 881, 887, 896, 902, 920, 935, 941, 980, 992, 1025, 1028, 1043
Offset: 1
-
def digits(n, b):
out = []
while n >= b:
out.append(n % b)
n //= b
return [n] + out[::-1]
def ok(n):
if n%3 == 0: return False
t = digits(n, 3)
if t.count(1) != t.count(2): return False
return all(t[:i].count(1) >= t[:i].count(2) for i in range(1, len(t)))
print([n for n in range(750) if ok(n)]) # after Michael S. Branicky (A340131)
Original entry on oeis.org
5, 15, 50, 150, 455, 1365, 4100, 12300, 36905, 110715, 332150, 996450, 2989355, 8968065, 26904200, 80712600, 242137805, 726413415, 2179240250, 6537720750, 19613162255, 58839486765, 176518460300, 529555380900, 1588666142705, 4765998428115, 14297995284350
Offset: 2
A001006(2) = 2, so a(2) = A340131(2) = 5.
A001006(3) = 4, so a(3) = A340131(4) = 15, etc.
A340131
Numbers whose ternary expansions have the same number of 1's and 2's and, in each prefix (initial fragment), at least as many 1's as 2's.
Original entry on oeis.org
0, 5, 11, 15, 29, 33, 44, 45, 50, 83, 87, 98, 99, 104, 116, 128, 132, 135, 140, 146, 150, 245, 249, 260, 261, 266, 278, 290, 294, 297, 302, 308, 312, 332, 344, 348, 377, 380, 384, 395, 396, 401, 405, 410, 416, 420, 434, 438, 449, 450, 455, 731, 735, 746, 747
Offset: 1
The first terms 0 and 5 are obvious, because the four intermediate ternary codes 1, 2, 10[3], and 11[4] are rejected due to a violation of the balance of 1's and 2's. Next, the successor function S works: for any term x, the next term is S(x).
Iterating over numbers is inefficient; code suffixes (final digits) can be processed faster. The transition from 0 to 12[5] is generalized for terms that are multiples of 9. For example,
S(10200[99]) = 10212[104], S(1122000[1188]) = 1122012[1193], etc.
In this case, the calculation of the subsequent term is reduced to simply replacing the suffix s = 00 with the subsequent suffix s'= 12.
Another common suffix is s = 02..2 = 02^k (twos are repeated at the end of the ternary code). Then the subsequent suffix is s'= 202..2 = 202^(k-1), i.e., within such a suffix, the first two digits are reversed. Here are some examples:
k = 1, S(1002[29]) = 1020[33], the increment is 4*3^0 = 4;
k = 2, S(110022[332]) = 110202[344], the increment is 4*3^1 = 12;
k = 3, S(10110222[2537]) = 10112022[2573], the increment is 4*3^2 = 36;
k = 4, S(111102222[9800]) = 111120222[9908], the increment is 4*3^3 = 108.
There are 5 such group suffixes.
-
is(n) = {my(d = digits(n, 3), v = [0, 0]); for(i = 1, #d, if(d[i] > 0, v[d[i]]++); if(v[1] < v[2], return(0))); v[1] == v[2] } \\ David A. Corneth, Dec 29 2020
-
def digits(n, b):
out = []
while n >= b:
out.append(n % b)
n //= b
return [n] + out[::-1]
def ok(n):
t = digits(n, 3)
if t.count(1) != t.count(2): return False
return all(t[:i].count(1) >= t[:i].count(2) for i in range(1, len(t)))
print([n for n in range(750) if ok(n)]) # Michael S. Branicky, Dec 29 2020
Comments