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-10 of 41 results. Next

A232560 Inverse permutation of the sequence of positive integers at A232559.

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 8, 7, 11, 10, 16, 9, 14, 13, 21, 12, 19, 18, 29, 17, 27, 26, 42, 15, 24, 23, 37, 22, 35, 34, 55, 20, 32, 31, 50, 30, 48, 47, 76, 28, 45, 44, 71, 43, 69, 68, 110, 25, 40, 39, 63, 38, 61, 60, 97, 36, 58, 57, 92, 56, 90, 89, 144, 33, 53, 52
Offset: 1

Views

Author

Clark Kimberling, Nov 26 2013

Keywords

Crossrefs

Programs

  • Maple
    g:= proc() local l, s; l, s:= [1], {1}:
          proc(n) option remember; local i, r; r:= l[1];
            l:= subsop(1=NULL, l);
            for i in [1+r, r+r] do if not i in s then
              l, s:=[l[], i], s union {i} fi
            od; r
          end
        end():
    a:= proc() local t, a; t, a:= 0, proc() -1 end;
          proc(n) local h;
            while a(n) < 0 do
              t:= t+1; h:= g(t);
              if a(h) < 0 then a(h):= t fi
            od; a(n)
          end
        end():
    seq(a(n), n=1..100);  # Alois P. Heinz, Sep 14 2021
  • Mathematica
    z = 12; g[1] = {1}; g[2] = {2}; g[n_] := Riffle[g[n - 1] + 1, 2 g[n - 1]]; j[2] = Join[g[1], g[2]]; j[n_] := Join[j[n - 1], g[n]]; g1[n_] := DeleteDuplicates[DeleteCases[g[n], Alternatives @@ j[n - 1]]]; g1[1] = g[1]; g1[2] = g[2]; t = Flatten[Table[g1[n], {n, 1, z}]]  (* A232559 *)
    Table[Length[g1[n]], {n, 1, z}] (* Fibonacci numbers *)
    t1 = Flatten[Table[Position[t, n], {n, 1, 200}]]  (* A232560 *)

A244860 Number of Fibonacci numbers in generation n of the tree at A232559.

Original entry on oeis.org

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

Views

Author

Clark Kimberling, Jul 07 2014

Keywords

Comments

Generation n consists of F(n) = A000045(n) distinct Fibonacci numbers. Is {a(n)} bounded above?

Examples

			In the table below, g(n) denotes generation n of the tree at A232559.
n ... g(n) ............ a(n)
1 ... {1} ............. 1
2 ... {2} ............. 1
3 ... {3,4} ........... 1
4 ... {5,6,8} ......... 2
5 ... {7,9,10,12,16} .. 0
		

Crossrefs

Programs

  • Mathematica
    z = 32; g[1] = {1}; f1[x_] := f1[x] = x + 1; f2[x_] := f2[x] = 2 x; h[1] = g[1]; b[n_] := b[n] = DeleteDuplicates[Union[f1[g[n - 1]], f2[g[n - 1]]]]; h[n_] := h[n] = Union[h[n - 1], g[n - 1]]; g[n_] := g[n] = Complement [b[n], Intersection[b[n], h[n]]]; f = Table[Fibonacci[n], {n, 1, 90}]; Table[Length[Intersection[g[n], f]], {n, 1, z}]
  • PARI
    \\ See Links section.

Extensions

More terms from Rémy Sigrist, Feb 13 2023

A226080 Denominators in the Fibonacci (or rabbit) ordering of the positive rational numbers.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 2, 1, 4, 3, 2, 3, 1, 5, 4, 3, 4, 2, 5, 3, 1, 6, 5, 4, 5, 3, 7, 4, 2, 7, 5, 3, 5, 1, 7, 6, 5, 6, 4, 9, 5, 3, 10, 7, 4, 7, 2, 9, 7, 5, 7, 3, 8, 5, 1, 8, 7, 6, 7, 5, 11, 6, 4, 13, 9, 5, 9, 3, 13, 10, 7, 10, 4, 11, 7, 2, 11, 9, 7, 9, 5, 12, 7
Offset: 1

Views

Author

Clark Kimberling, May 25 2013

Keywords

Comments

Let S be the set of numbers defined by these rules: 1 is in S, and if x is in S, then x+1 and 1/x are in S. Then S is the set of positive rational numbers, which arise in generations as follows: g(1) = (1/1), g(2) = (1+1) = (2), g(3) = (2+1, 1/2) = (3/1, 1/2), g(4) = (4/1, 1/3, 3/2), ... . Once g(n-1) = (g(1), ..., g(z)) is defined, g(n) is formed from the vector (g(1) + 1, 1/g(1), g(2) + 1, 1/g(2), ..., g(z) + 1, 1/g(z)) by deleting all elements that are in a previous generation. A226080 is the sequence of denominators formed by concatenating the generations g(1), g(2), g(3), ... . It is easy to prove the following:
(1) Every positive rational is in S.
(2) The number of terms in g(n) is the n-th Fibonacci number, F(n) = A000045(n).
(3) For n > 2, g(n) consists of F(n-2) numbers < 1 and F(n-1) numbers > 1, hence the name "rabbit ordering" since the n-th generation has F(n-2) reproducing pairs and F(n-1) non-reproducing pairs, as in the classical rabbit-reproduction introduction to Fibonacci numbers.
(4) The positions of integers in S are the Fibonacci numbers.
(5) The positions of 1/2, 3/2, 5/2, ..., are Lucas numbers (A000032).
(6) Continuing from (4) and (5), suppose that n > 0 and 0 < r < n, where gcd(n,r) = 1. The positions in A226080 of the numbers congruent to r mod n comprise a row of the Wythoff array, W = A035513. The correspondence is sampled here:
row 1 of W: positions of n+1 for n>=0,
row 2 of W: positions of n+1/2,
row 3 of W: positions of n+1/3,
row 4 of W: positions of n+1/4,
row 5 of W: positions of n+2/3,
row 6 of W: positions of n+1/5,
row 7 of W: positions of n+3/4.
(7) If the numbers <=1 in S are replaced by 1 and those >1 by 0, the resulting sequence is the infinite Fibonacci word A003849 (except for the 0-offset first term).
(8) The numbers <=1 in S occupy positions -1 + A001950, where A001950 is the upper Wythoff sequence; those > 1 occupy positions given by -1 + A000201, where A000201 is the lower Wythoff sequence.
(9) The rules (1 is in S, and if x is in S, then 1/x and 1/(x+1) are in S) also generate all the positive rationals.
A variant which extends this idea to an ordering of all rationals is described in A226130. - M. F. Hasler, Jun 03 2013
The updown and downup zigzag limits are (-1 + sqrt(5))/2 and (1 + sqrt(5))/2; see A020651. - Clark Kimberling, Nov 10 2013
From Clark Kimberling, Jun 19 2014: (Start)
Following is a guide to related trees and sequences; for example, the tree A226080 is represented by (1, x+1, 1/x), meaning that 1 is in S, and if x is in S, then x+1 and 1/x are in S (except for x = 0).
All the positive integers:
A243571, A243572, A232559 (1, x+1, 2x)
A232561, A242365, A243572 (1, x+1, 3x)
A243573 (1, x+1, 4x)
All the integers:
A243610 (1, 2x, 1-x)
All the positive rationals:
A226080, A226081, A242359, A242360 (1, x+1, 1/x)
A243848, A243849, A243850 (1, x+1, 2/x)
A243851, A243852, A243853 (1, x+1, 3/x)
A243854, A243855, A243856 (1, x+1, 4/x)
A243574, A242308 (1, 1/x, 1/(x+1))
A241837, A243575 ({1,2,3}, x+4, 12/x)
A242361, A242363 (1, 1 + 1/x, 1/x)
A243613, A243614 (0, x+1, x/(x+1))
All the rationals:
A243611, A243612 (0, x+1, -1/(x+1))
A226130, A226131 (1, x+1, -1/x)
A243712, A243713 ({1,2,3}, x+1, 1/(x+1))
A243730, A243731 ({1,2,3,4}, x+1, 1/(x+1))
A243732, A243733 ({1,2,3,4,5}, x+1, 1/(x+1))
A243925, A243926, A243927 (1, x+1, -2/x)
A243928, A243929, A243930 (1, x+1, -3/x)
All the Gaussian integers:
A243924 (1, x+1, i*x)
All the Gaussian rational numbers:
A233694, A233695, A233696 (1, x+1, i*x, 1/x).
(End)

Examples

			The denominators are read from the rationals listed in "rabbit order":
1/1, 2/1, 3/1, 1/2, 4/1, 1/3, 3/2, 5/1, 1/4, 4/3, 5/2, 2/3, 6/1, ...
		

Crossrefs

Cf. A000045, A035513, A226081 (numerators), A226130, A226247, A020651.

Programs

  • Mathematica
    z = 10; g[1] = {1}; g[2] = {2}; g[3] = {3, 1/2};
    j[3] = Join[g[1], g[2], g[3]]; j[n_] := Join[j[n - 1], g[n]];
    d[s_List, t_List] := Part[s, Sort[Flatten[Map[Position[s, #] &, Complement[s, t]]]]]; j[3] = Join[g[1], g[2], g[3]]; n = 3; While[n <= z, n++; g[n] = d[Riffle[g[n - 1] + 1, 1/g[n - 1]], g[n - 2]]];
    Table[g[n], {n, 1, z}]; j[z] (* rabbit-ordered rationals *)
    Denominator[j[z]]  (* A226080 *)
    Numerator[j[z]]    (* A226081 *)
    Flatten[NestList[(# /. x_ /; x > 1 -> Sequence[x, 1/x - 1]) + 1 &, {1}, 9]] (* rabbit-ordered rationals, Danny Marmer, Dec 07 2014 *)
  • PARI
    A226080_vec(N=100)={my(T=[1],S=T,A=T); while(N>#A=concat(A, apply(denominator, T=select(t->!setsearch(S,t), concat(apply(t->[t+1,1/t],T))))), S=setunion(S,Set(T)));A} \\ M. F. Hasler, Nov 30 2018
    
  • PARI
    (A226080(n)=denominator(RabbitOrderedRational(n))); ROR=List(1); RabbitOrderedRational(n)={if(n>#ROR, local(S=Set(ROR), i=#ROR*2\/(sqrt(5)+1), a(t)=setsearch(S,t)||S=setunion(S,[listput(ROR,t)])); until( type(ROR[i+=1])=="t_INT" && n<=#ROR, a(ROR[i]+1); a(1/ROR[i])));ROR[n]} \\ M. F. Hasler, Nov 30 2018

A036561 Nicomachus triangle read by rows, T(n, k) = 2^(n - k)*3^k, for 0 <= k <= n.

Original entry on oeis.org

1, 2, 3, 4, 6, 9, 8, 12, 18, 27, 16, 24, 36, 54, 81, 32, 48, 72, 108, 162, 243, 64, 96, 144, 216, 324, 486, 729, 128, 192, 288, 432, 648, 972, 1458, 2187, 256, 384, 576, 864, 1296, 1944, 2916, 4374, 6561, 512, 768, 1152, 1728, 2592, 3888, 5832, 8748, 13122, 19683
Offset: 0

Views

Author

Keywords

Comments

The triangle pertaining to this sequence has the property that every row, every column and every diagonal contains a nontrivial geometric progression. More interestingly every line joining any two elements contains a nontrivial geometric progression. - Amarnath Murthy, Jan 02 2002
Kappraff states (pp. 148-149): "I shall refer to this as Nicomachus' table since an identical table of numbers appeared in the Arithmetic of Nicomachus of Gerasa (circa 150 A.D.)" The table was rediscovered during the Italian Renaissance by Leon Battista Alberti, who incorporated the numbers in dimensions of his buildings and in a system of musical proportions. Kappraff states "Therefore a room could exhibit a 4:6 or 6:9 ratio but not 4:9. This ensured that ratios of these lengths would embody musical ratios". - Gary W. Adamson, Aug 18 2003
After Nichomachus and Alberti several Renaissance authors described this table. See for instance Pierre de la Ramée in 1569 (facsimile of a page of his Arithmetic Treatise in Latin in the links section). - Olivier Gérard, Jul 04 2013
The triangle sums, see A180662 for their definitions, link Nicomachus's table with eleven different sequences, see the crossrefs. It is remarkable that these eleven sequences can be described with simple elegant formulas. The mirror of this triangle is A175840. - Johannes W. Meijer, Sep 22 2010
The diagonal sums Sum_{k} T(n - k, k) give A167762(n + 2). - Michael Somos, May 28 2012
Where d(n) is the divisor count function, then d(T(i,j)) = A003991, the rows of which sum to the tetrahedral numbers A000292(n+1). For example, the sum of the divisors of row 4 of this triangle (i = 4), gives d(16) + d(24) + d(36) + d(54) + d(81) = 5 + 8 + 9 + 8 + 5 = 35 = A000292(5). In fact, where p and q are distinct primes, the aforementioned relationship to the divisor function and tetrahedral numbers can be extended to any triangle of numbers in which the i-th row is of form {p^(i-j)*q^j, 0<=j<=i}; i >= 0 (e.g., A003593, A003595). - Raphie Frank, Nov 18 2012, corrected Dec 07 2012
Sequence (or tree) generated by these rules: 1 is in S, and if x is in S, then 2*x and 3*x are in S, and duplicates are deleted as they occur; see A232559. - Clark Kimberling, Nov 28 2013
Partial sums of rows produce Stirling numbers of the 2nd kind: A000392(n+2) = Sum_{m=1..(n^2+n)/2} a(m). - Fred Daniel Kline, Sep 22 2014
A permutation of A003586. - L. Edson Jeffery, Sep 22 2014
Form a word of length i by choosing a (possibly empty) word on alphabet {0,1} then concatenating a word of length j on alphabet {2,3,4}. T(i,j) is the number of such words. - Geoffrey Critzer, Jun 23 2016
Form of Zorach additive triangle (see A035312) where each number is sum of west and northwest numbers, with the additional condition that each number is GCD of the two numbers immediately below it. - Michel Lagneau, Dec 27 2018

Examples

			The start of the sequence as a triangular array read by rows:
   1
   2   3
   4   6   9
   8  12  18  27
  16  24  36  54  81
  32  48  72 108 162 243
  ...
The start of the sequence as a table T(n,k) n, k > 0:
    1    2    4    8   16   32 ...
    3    6   12   24   48   96 ...
    9   18   36   72  144  288 ...
   27   54  108  216  432  864 ...
   81  162  324  648 1296 2592 ...
  243  486  972 1944 3888 7776 ...
  ...
- _Boris Putievskiy_, Jan 08 2013
		

References

  • Jay Kappraff, Beyond Measure, World Scientific, 2002, p. 148.
  • Flora R. Levin, The Manual of Harmonics of Nicomachus the Pythagorean, Phanes Press, 1994, p. 114.

Crossrefs

Cf. A001047 (row sums), A000400 (central terms), A013620, A007318.
Triangle sums (see the comments): A001047 (Row1); A015441 (Row2); A005061 (Kn1, Kn4); A016133 (Kn2, Kn3); A016153 (Fi1, Fi2); A016140 (Ca1, Ca4); A180844 (Ca2, Ca3); A180845 (Gi1, Gi4); A180846 (Gi2, Gi3); A180847 (Ze1, Ze4); A016185 (Ze2, Ze3). - Johannes W. Meijer, Sep 22 2010, Sep 10 2011
Antidiagonal cumulative sum: A000392; square arrays cumulative sum: A160869. Antidiagonal products: 6^A000217; antidiagonal cumulative products: 6^A000292; square arrays products: 6^A005449; square array cumulative products: 6^A006002.

Programs

  • Haskell
    a036561 n k = a036561_tabf !! n !! k
    a036561_row n = a036561_tabf !! n
    a036561_tabf = iterate (\xs@(x:_) -> x * 2 : map (* 3) xs) [1]
    -- Reinhard Zumkeller, Jun 08 2013
    
  • Magma
    /* As triangle: */ [[(2^(i-j)*3^j)/3: j in [1..i]]: i in [1..10]]; // Vincenzo Librandi, Oct 17 2014
  • Maple
    A036561 := proc(n,k): 2^(n-k)*3^k end:
    seq(seq(A036561(n,k),k=0..n),n=0..9);
    T := proc(n,k) option remember: if k=0 then 2^n elif k>=1 then procname(n,k-1) + procname(n-1,k-1) fi: end: seq(seq(T(n,k),k=0..n),n=0..9);
    # Johannes W. Meijer, Sep 22 2010, Sep 10 2011
  • Mathematica
    Flatten[Table[ 2^(i-j) 3^j, {i, 0, 12}, {j, 0, i} ]] (* Flatten added by Harvey P. Dale, Jun 07 2011 *)
  • PARI
    for(i=0,9,for(j=0,i,print1(3^j<<(i-j)", "))) \\ Charles R Greathouse IV, Dec 22 2011
    
  • PARI
    {T(n, k) = if( k<0 || k>n, 0, 2^(n - k) * 3^k)} /* Michael Somos, May 28 2012 */
    

Formula

T(n,k) = A013620(n,k)/A007318(n,k). - Reinhard Zumkeller, May 14 2006
T(n,k) = T(n,k-1) + T(n-1,k-1) for n>=1 and 1<=k<=n with T(n,0) = 2^n for n>=0. - Johannes W. Meijer, Sep 22 2010
T(n,k) = 2^(k-1)*3^(n-1), n, k > 0 read by antidiagonals. - Boris Putievskiy, Jan 08 2013
a(n) = 2^(A004736(n)-1)*3^(A002260(n)-1), n > 0, or a(n) = 2^(j-1)*3^(i-1) n > 0, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor[(-1+sqrt(8*n-7))/2]. - Boris Putievskiy, Jan 08 2013
G.f.: 1/((1-2x)(1-3yx)). - Geoffrey Critzer, Jun 23 2016
T(n,k) = (-1)^n * Sum_{q=0..n} (-1)^q * C(k+3*q, q) * C(n+2*q, n-q). - Marko Riedel, Jul 01 2024

A048679 Compressed fibbinary numbers (A003714), with rewrite 0->0, 01->1 applied to their binary expansion.

Original entry on oeis.org

0, 1, 2, 4, 3, 8, 5, 6, 16, 9, 10, 12, 7, 32, 17, 18, 20, 11, 24, 13, 14, 64, 33, 34, 36, 19, 40, 21, 22, 48, 25, 26, 28, 15, 128, 65, 66, 68, 35, 72, 37, 38, 80, 41, 42, 44, 23, 96, 49, 50, 52, 27, 56, 29, 30, 256, 129, 130, 132, 67, 136, 69, 70, 144, 73, 74, 76, 39, 160, 81
Offset: 0

Views

Author

Keywords

Comments

Permutation of the nonnegative integers (A001477); inverse permutation of A048680 i.e. A048679[ A048680[ n ] ] = n for all n.

Crossrefs

Programs

  • Maple
    a(n) = rewrite_0to0_x1to1(fibbinary(j)) (where fibbinary(j) = A003714[ n ])
    rewrite_0to0_x1to1 := proc(n) option remember; if(0 = n) then RETURN(n); else RETURN((2 * rewrite_0to0_x1to1(floor(n/(2^(1+(n mod 2)))))) + (n mod 2)); fi; end;
    fastfib := n -> round((((sqrt(5)+1)/2)^n)/sqrt(5)); fibinv_appr := n -> floor(log[ (sqrt(5)+1)/2 ](sqrt(5)*n)); fibinv := n -> (fibinv_appr(n) + floor(n/fastfib(1+fibinv_appr(n)))); fibbinary := proc(n) option remember; if(n <= 2) then RETURN(n); else RETURN((2^(fibinv(n)-2))+fibbinary_seq(n-fastfib(fibinv(n)))); fi; end;
    # second Maple program:
    b:= proc(n) is(n=0) end:
    a:= proc(n) option remember; local h; h:= iquo(a(n-1), 2)+1;
          while b(h) do h:= h*2 od; b(h):=true; h
        end: a(0):=0:
    seq(a(n), n=0..100);  # Alois P. Heinz, Sep 22 2014
  • Mathematica
    b[n_] := n==0; a[n_] := a[n] = Module[{h}, h = Quotient[a[n-1], 2] + 1; While[b[h], h = h*2]; b[h] = True; h]; a[0]=0; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 27 2016, after Alois P. Heinz *)
  • PARI
    A072649(n) = { my(m); if(n<1, 0, m=0; until(fibonacci(m)>n, m++); m-2); }; \\ From A072649
    A003714(n) = { my(s=0,w); while(n>2, w = A072649(n); s += 2^(w-1); n -= fibonacci(w+1)); (s+n); }
    A007814(n) = valuation(n,2);
    A000265(n) = (n/2^valuation(n, 2));
    A106151(n) = if(n<=1,n,if(n%2,1+(2*A106151((n-1)/2)),(2^(A007814(n)-1))*A106151(A000265(n))));
    A048679(n) = if(!n,n,A106151(2*A003714(n))); \\ Antti Karttunen, May 13 2018, after Reinhard Zumkeller's May 09 2005 formula.
    
  • Python
    from itertools import count, islice
    def A048679_gen(): # generator of terms
        return map(lambda n: int(bin(n)[2:].replace('01','1'),2),filter(lambda n:not (n<<1)&n,count(0)))
    A048679_list = list(islice(A048679_gen(),20)) # Chai Wah Wu, Mar 18 2024
    
  • Python
    def A048679(n):
        tlist, s = [1,2], 0
        while tlist[-1]+tlist[-2] <= n: tlist.append(tlist[-1]+tlist[-2])
        for d in tlist[::-1]:
            if d <= n:
                s += 1
                n -= d
            else:
                s <<= 1
        return s # Chai Wah Wu, Apr 24 2025

Formula

a(n) = A106151(2*A003714(n)) for n > 0. - Reinhard Zumkeller, May 09 2005
a(n+1) = min{([a(n)/2]+1)*2^k} such that it is not yet in the sequence. - Gerard Orriols, Jun 07 2014
a(n) = A072650(A003714(n)) = A003188(A227351(n)). - Antti Karttunen, May 13 2018

A243571 Irregular triangular array generated as in Comments; contains every positive integer exactly once.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 12, 16, 11, 13, 14, 17, 18, 20, 24, 32, 15, 19, 21, 22, 25, 26, 28, 33, 34, 36, 40, 48, 64, 23, 27, 29, 30, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 65, 66, 68, 72, 80, 96, 128, 31, 39, 43, 45, 46, 51, 53, 54, 57, 58, 60, 67, 69
Offset: 1

Views

Author

Clark Kimberling, Jun 07 2014

Keywords

Comments

Decree that row 1 is (1) and row 2 is (2). For n >= 3, row n consists of numbers in increasing order generated as follows: 2*x for each x in row n-1 together with 1+2*x for each x in row n-2. It is easy to prove that row n consists of F(n) numbers, where F = A000045 (the Fibonacci numbers), and that every positive integer occurs exactly once. Row n has F(n-1) even numbers and F(n-2) odd numbers.
The least and greatest numbers in row n are A083329(n-1) and 2^(n-1), for n >= 1.

Examples

			First 6 rows of the array:
  1
  2
  3 ... 4
  5 ... 6 ... 8
  7 ... 9 ... 10 .. 12 .. 16
  11 .. 13 .. 14 .. 17 .. 18 .. 20 .. 24 .. 32
		

Crossrefs

Cf. A052955 for the first element in each row.

Programs

  • Mathematica
    z = 10; g[1] = {1}; f1[x_] := x + 1; f2[x_] := 2 x; h[1] = g[1];
    b[n_] := b[n] = DeleteDuplicates[Union[f1[g[n - 1]], f2[g[n - 1]]]];
    h[n_] := h[n] = Union[h[n - 1], g[n - 1]];
    g[n_] := g[n] = Complement [b[n], Intersection[b[n], h[n]]]
    u = Table[g[n], {n, 1, z}]; v = Flatten[u] (* A243571 *)

A385816 The number k such that the k-th composition in standard order lists the maximal anti-run lengths of the binary indices of n. Standard composition number of row n of A384877.

Original entry on oeis.org

0, 1, 1, 3, 1, 2, 3, 7, 1, 2, 2, 6, 3, 5, 7, 15, 1, 2, 2, 6, 2, 4, 6, 14, 3, 5, 5, 13, 7, 11, 15, 31, 1, 2, 2, 6, 2, 4, 6, 14, 2, 4, 4, 12, 6, 10, 14, 30, 3, 5, 5, 13, 5, 9, 13, 29, 7, 11, 11, 27, 15, 23, 31, 63, 1, 2, 2, 6, 2, 4, 6, 14, 2, 4, 4, 12, 6, 10, 14
Offset: 0

Views

Author

Gus Wiseman, Jul 15 2025

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.
The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.
If the k-th composition in standard order is y, then the standard composition number of y is defined to be k.

Examples

			The binary indices of 181 are {1,3,5,6,8}, with maximal anti-runs ((1,3,5),(6,8)), with lengths (3,2), which is the 18th composition in standard order, so a(181) = 18.
		

Crossrefs

The reverse version is A209859.
Sorted positions of first appearances are A247648.
These are standard composition numbers of rows of A384877 (duplicates removed A385886).
For runs instead of anti-runs the reverse is A385887 (duplicates removed A232559).
For runs instead of anti-runs we have A385889 (duplicates removed A385818).
A245563 lists run lengths of binary indices (ranks A246029), reverse A245562.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    stcinv[q_]:=Total[2^(Accumulate[Reverse[q]])]/2;
    stcinv/@Table[Length/@Split[bpe[n],#2!=#1+1&],{n,0,100}]

A232639 Inverse permutation of the sequence of positive integers at A232638.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 6, 9, 8, 12, 11, 17, 10, 15, 14, 22, 13, 20, 19, 30, 18, 28, 27, 43, 16, 25, 24, 38, 23, 36, 35, 56, 21, 33, 32, 51, 31, 49, 48, 77, 29, 46, 45, 72, 44, 70, 69, 111, 26, 41, 40, 64, 39, 62, 61, 98, 37, 59, 58, 93, 57, 91, 90, 145, 34, 54
Offset: 1

Views

Author

Clark Kimberling, Nov 28 2013

Keywords

Crossrefs

Programs

  • Mathematica
    z = 14; g[1] = {1}; g[2] = {2}; g[n_] := Riffle[g[n - 1] + 1, 2 g[n - 1] - 1]; j[2] = Join[g[1], g[2]]; j[n_] := Join[j[n - 1], g[n]]; g1[n_] := DeleteDuplicates[DeleteCases[g[n], Alternatives @@ j[n - 1]]]; g1[1] = g[1]; g1[2] = g[2]; t = Flatten[Table[g1[n], {n, 1, z}]]  (* A232638 *)
    Table[Length[g1[n]], {n, 1, z}]  (* A000045 *)
    Flatten[Table[Position[t, n], {n, 1, 200}]]  (* A232639 *)

A232642 Sequence (or tree) generated by these rules: 1 is in S, and if x is in S, then x + 1 and 2*x + 2 are in S, and duplicates are deleted as they occur.

Original entry on oeis.org

1, 2, 4, 3, 6, 5, 10, 8, 7, 14, 12, 11, 22, 9, 18, 16, 15, 30, 13, 26, 24, 23, 46, 20, 19, 38, 17, 34, 32, 31, 62, 28, 27, 54, 25, 50, 48, 47, 94, 21, 42, 40, 39, 78, 36, 35, 70, 33, 66, 64, 63, 126, 29, 58, 56, 55, 110, 52, 51, 102, 49, 98, 96, 95, 190, 44
Offset: 1

Views

Author

Clark Kimberling, Nov 28 2013

Keywords

Comments

Let S be the set of numbers defined by these rules: 1 is in S, and if x is in S, then x + 1 and 2*x + 2 are in S. Then S is the set of positive integers, which arise in generations. Deleting duplicates as they occur, the generations are given by g(1) = (1), g(2) = (2,4), g(3) = (3,6,5,10), etc. Concatenating these gives A232642, a permutation of the positive integers. For n > 1, the number of numbers in g(n) is 2*F(n+1), where F = A000045, the Fibonacci numbers. It is helpful to show the results as a tree with the terms of S as nodes, an edge from x to x + 1 if x + 1 has not already occurred, and an edge from x to 2*x + 2 if 2*x + 2 has not already occurred.
Seen as triangle read by rows: A082560 with duplicates removed. - Reinhard Zumkeller, May 14 2015

Examples

			Each x begets x + 1 and 2*x + 2, but if either has already occurred it is deleted. Thus, 1 begets 2 and 4; then 2 begets 3 and 6, and 4 begets 5 and 10, so that g(3) = (3,6,5,10).
First 5 generations, also showing the places where duplicates were removed:
.  1:                                1
.  2:                2                               4
.  3:        3              6               5                10
.  4:    _       8      7       14      _       12       11       22
.  5:  _  __   9  18  _  16  15   30  _  __  13   26  __   24  23   46
These are the corresponding complete rows of triangle A082560:
.  1:                                1
.  2:                2                               4
.  3:        3              6               5                10
.  4:    4       8      7       14      6       12       11       22
.  5:  5  10   9  18  8  16  15   30  7  14  13   26  12   24  23   46
		

Crossrefs

Cf. A128588 (row lengths), A033484 (right edges), A257956 (row sums), A082560.

Programs

  • Haskell
    import Data.List.Ordered (member); import Data.List (sort)
    a232642 n k = a232642_tabf !! (n-1) !! (k-1)
    a232642_row n = a232642_tabf !! (n-1)
    a232642_tabf = f a082560_tabf [] where
       f (xs:xss) zs = ys : f xss (sort (ys ++ zs)) where
         ys = [v | v <- xs, not $ member v zs]
    a232642_list = concat a232642_tabf
    -- Reinhard Zumkeller, May 14 2015
  • Mathematica
    z = 14; g[1] = {1}; g[2] = {2}; g[n_] := Riffle[g[n - 1] + 1, 2 g[n - 1] + 2]; j[2] = Join[g[1], g[2]]; j[n_] := Join[j[n - 1], g[n]]; g1[n_] := DeleteDuplicates[DeleteCases[g[n], Alternatives @@ j[n - 1]]]; g1[1] = g[1]; g1[2] = g[2]; t = Flatten[Table[g1[n], {n, 1, z}]]  (* A232642 *)
    Table[Length[g1[n]], {n, 1, z}]  (* A000045 *)
    Flatten[Table[Position[t, n], {n, 1, 200}]]  (* A232643 *)

Extensions

Keyword tabf added, to bring out function g, by Reinhard Zumkeller, May 14 2015

A353654 Numbers whose binary expansion has the same number of trailing 0 bits as other 0 bits.

Original entry on oeis.org

1, 3, 7, 10, 15, 22, 26, 31, 36, 46, 54, 58, 63, 76, 84, 94, 100, 110, 118, 122, 127, 136, 156, 172, 180, 190, 204, 212, 222, 228, 238, 246, 250, 255, 280, 296, 316, 328, 348, 364, 372, 382, 392, 412, 428, 436, 446, 460, 468, 478, 484, 494, 502, 506, 511, 528, 568
Offset: 1

Views

Author

Mikhail Kurkov, Jul 15 2022

Keywords

Comments

Numbers k such that A007814(k) = A086784(k).
To reproduce the sequence through itself, use the following rule: if binary 1xyz is a term then so are 11xyz and 10xyz0 (except for 1 alone where 100 is not a term).
The number of terms with bit length k is equal to Fibonacci(k-1) for k > 1.
Conjecture: 2*A247648(n-1) + 1 with rewrite 1 -> 1, 01 -> 0 applied to binary expansion is the same as a(n) without trailing 0 bits in binary.
Odd terms are positive Mersenne numbers (A000225), because there is no 0 in their binary expansion. - Bernard Schott, Oct 12 2022

Crossrefs

Cf. A356385 (first differences).
Subsequences with same number k of trailing 0 bits and other 0 bits: A000225 (k=0), 2*A190620 (k=1), 4*A357773 (k=2), 8*A360573 (k=3).

Programs

  • Maple
    N:= 10: # for terms <= 2^N
    S:= {1};
    for d from 1 to N do
      for k from 0 to d/2-1 do
        B:= combinat:-choose([$k+1..d-2],k);
        S:= S union convert(map(proc(t) local s; 2^d - 2^k - add(2^(s),s=t) end proc,B),set);
    od od:
    sort(convert(S,list)); # Robert Israel, Sep 21 2023
  • Mathematica
    Join[{1}, Select[Range[2, 600], IntegerExponent[#, 2] == Floor[Log2[# - 1]] - DigitCount[# - 1, 2, 1] &]] (* Amiram Eldar, Jul 16 2022 *)
  • PARI
    isok(k) = if (k==1, 1, (logint(k-1, 2)-hammingweight(k-1) == valuation(k, 2))); \\ Michel Marcus, Jul 16 2022
    
  • Python
    from itertools import islice, count
    def A353654_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:(m:=(~n & n-1).bit_length()) == bin(n>>m)[2:].count('0'),count(max(startvalue,1)))
    A353654_list = list(islice(A353654_gen(),30)) # Chai Wah Wu, Oct 14 2022

Formula

a(n) = a(n-1) + A356385(n-1) for n > 1 with a(1) = 1.
Conjectured formulas: (Start)
a(n) = 2^g(n-1)*(h(n-1) + 2^A000523(h(n-1))*(2 - g(n-1))) for n > 2 with a(1) = 1, a(2) = 3 where f(n) = n - A130312(n), g(n) = [n > 2*f(n)] and where h(n) = a(f(n) + 1).
a(n) = 1 + 2^r(n-1) + Sum_{k=1..r(n-1)} (1 - g(s(n-1, k)))*2^(r(n-1) - k) for n > 1 with a(1) = 1 where r(n) = A072649(n) and where s(n, k) = f(s(n, k-1)) for n > 0, k > 1 with s(n, 1) = n.
a(n) = 2*(2 + Sum_{k=1..n-2} 2^(A213911(A280514(k)-1) + 1)) - 2^A200650(n) for n > 1 with a(1) = 1.
A025480(a(n)-1) = A348366(A343152(n-1)) for n > 1.
a(A000045(n)) = 2^(n-1) - 1 for n > 1. (End)
Showing 1-10 of 41 results. Next