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 12 results. Next

A353848 Numbers k such that the k-th composition in standard order (row k of A066099) has all equal run-sums.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 8, 10, 11, 14, 15, 16, 31, 32, 36, 39, 42, 46, 59, 60, 63, 64, 127, 128, 136, 138, 143, 168, 170, 175, 187, 238, 248, 250, 255, 256, 292, 316, 487, 511, 512, 528, 543, 682, 750, 955, 1008, 1023, 1024, 2047, 2048, 2080, 2084, 2090, 2111, 2184
Offset: 0

Views

Author

Gus Wiseman, May 30 2022

Keywords

Comments

Every sequence can be uniquely split into non-overlapping runs, read left-to-right. For example, the runs of (2,2,1,1,1,3,2,2) are ((2,2),(1,1,1),(3),(2,2)), with sums (4,3,3,4).
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.

Examples

			The terms together with their binary expansions and corresponding compositions begin:
     0:       0  ()
     1:       1  (1)
     2:      10  (2)
     3:      11  (1,1)
     4:     100  (3)
     7:     111  (1,1,1)
     8:    1000  (4)
    10:    1010  (2,2)
    11:    1011  (2,1,1)
    14:    1110  (1,1,2)
    15:    1111  (1,1,1,1)
    16:   10000  (5)
    31:   11111  (1,1,1,1,1)
    32:  100000  (6)
    36:  100100  (3,3)
    39:  100111  (3,1,1,1)
    42:  101010  (2,2,2)
    46:  101110  (2,1,1,2)
    59:  111011  (1,1,2,1,1)
    60:  111100  (1,1,1,3)
For example:
- The 59th composition in standard order is (1,1,2,1,1), with run-sums (2,2,2), so 59 is in the sequence.
- The 2298th composition in standard order is (4,1,1,1,1,2,2), with run-sums (4,4,4), so 2298 is in the sequence.
- The 2346th composition in standard order is (3,3,2,2,2), with run-sums (6,6), so 2346 is in the sequence.
		

Crossrefs

Standard compositions are listed by A066099.
For equal lengths instead of sums we have A353744, counted by A329738.
The version for partitions is A353833, counted by A304442.
These compositions are counted by A353851.
The distinct instead of equal version is A353852, counted by A353850.
The run-sums themselves are listed by A353932, with A353849 distinct terms.
A005811 counts runs in binary expansion.
A300273 ranks collapsible partitions, counted by A275870.
A351014 counts distinct runs in standard compositions, firsts A351015.
A353840-A353846 pertain to partition run-sum trajectory.
A353847 represents the run-sum transformation for compositions.
A353853-A353859 pertain to composition run-sum trajectory.
A353860 counts collapsible compositions.
A353863 counts run-sum-complete partitions.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    Select[Range[0,100],SameQ@@Total/@Split[stc[#]]&]

Formula

A353849(a(n)) = 1.

A165413 a(n) is the number of distinct lengths of runs in the binary representation of n.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 1, 2, 2, 2, 2, 2, 2, 3, 2, 1, 2, 2, 2, 3, 1, 3, 2, 3, 2, 2, 2, 1, 2, 2, 2, 3, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 3, 2
Offset: 1

Views

Author

Leroy Quet, Sep 17 2009

Keywords

Comments

Least k whose value is n: 1, 4, 35, 536, 16775, 1060976, ..., = A165933. - Robert G. Wilson v, Sep 30 2009

Examples

			92 in binary is 1011100. There is a run of one 1, followed by a run of one 0, then a run of three 1's, then finally a run of two 0's. The run lengths are therefore (1,1,3,2). The distinct values of these run lengths are (1,3,2). Since there are 3 distinct values, then a(92) = 3.
		

Crossrefs

Cf. A140690 (locations of 1's), A165933 (locations of new highs).

Programs

  • Haskell
    import Data.List (group, nub)
    a165413 = length . nub . map length . group . a030308_row
    -- Reinhard Zumkeller, Mar 02 2013
    
  • Mathematica
    f[n_] := Length@ Union@ Map[ Length, Split@ IntegerDigits[n, 2]]; Array[f, 105] (* Robert G. Wilson v, Sep 30 2009 *)
  • PARI
    binruns(n) = {
      if (n == 0, return([1, 0]));
      my(bag = List(), v=0);
      while(n != 0,
            v = valuation(n,2); listput(bag, v); n >>= v; n++;
            v = valuation(n,2); listput(bag, v); n >>= v; n--);
      return(Vec(bag));
    };
    a(n) = #Set(select(k->k, binruns(n)));
    vector(105, i, a(i))  \\ Gheorghe Coserea, Sep 17 2015
    
  • Python
    from itertools import groupby
    def a(n): return len(set([len(list(g)) for k, g in groupby(bin(n)[2:])]))
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Jan 04 2021

Formula

a(n) = 1 for n in A140690. - Robert G. Wilson v, Sep 30 2009

Extensions

More terms from Robert G. Wilson v, Sep 30 2009

A382913 Numbers k such that row k of A305936 (a multiset whose multiplicities are the prime indices of k) has a permutation with all distinct run-lengths.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 25, 26, 29, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 46, 47, 49, 51, 53, 55, 57, 58, 59, 61, 62, 65, 66, 67, 69, 70, 71, 73, 74, 77, 78, 79, 82, 83, 85, 86, 87, 89, 91, 93, 94, 95, 97, 101, 102, 103
Offset: 1

Views

Author

Gus Wiseman, Apr 12 2025

Keywords

Comments

This described multiset (row n of A305936, Heinz number A181821) is generally not the same as the multiset of prime indices of n (A112798). For example, the prime indices of 12 are {1,1,2}, while a multiset whose multiplicities are {1,1,2} is {1,1,2,3}.
A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798, sum A056239.

Examples

			The terms, prime indices, and corresponding multisets begin:
   1:    {} {}
   2:   {1} {1}
   3:   {2} {1,1}
   5:   {3} {1,1,1}
   6: {1,2} {1,1,2}
   7:   {4} {1,1,1,1}
  10: {1,3} {1,1,1,2}
  11:   {5} {1,1,1,1,1}
  13:   {6} {1,1,1,1,1,1}
  14: {1,4} {1,1,1,1,2}
  15: {2,3} {1,1,1,2,2}
  17:   {7} {1,1,1,1,1,1,1}
  19:   {8} {1,1,1,1,1,1,1,1}
  21: {2,4} {1,1,1,1,2,2}
  22: {1,5} {1,1,1,1,1,2}
  23:   {9} {1,1,1,1,1,1,1,1,1}
  25: {3,3} {1,1,1,2,2,2}
  26: {1,6} {1,1,1,1,1,1,2}
		

Crossrefs

Look-and-Say partitions are counted by A239455, ranks A351294.
Non-Look-and-Say partitions are counted by A351293, ranks A351295.
For prime indices instead of signature we have A351294, conjugate A381432.
The Look-and-Say partition of n is listed by A381440, rank A048767.
The complement is A382912.
For equal run-lengths we have the complement of A382914, see A382858, A382879, A382915.
A044813 lists numbers whose binary expansion has distinct run-lengths.
A055396 gives least prime index, greatest A061395.
A056239 adds up prime indices, row sums of A112798.
A329739 counts compositions with distinct run-lengths, ranks A351596.
A381431 ranks section-sum partition, listed by A381436.

Programs

  • Mathematica
    nrmptn[n_]:=Join@@MapIndexed[Table[#2[[1]],{#1}]&, If[n==1,{},Flatten[Cases[FactorInteger[n]//Reverse,{p_,k_} :> Table[PrimePi[p],{k}]]]]];
    lasQ[y_]:=Select[Permutations[y], UnsameQ@@Length/@Split[#]&]!={};
    Select[Range[100],lasQ@*nrmptn]

A382773 Number of ways to permute a multiset whose multiplicities are the prime indices of n so that the run-lengths are all different.

Original entry on oeis.org

1, 1, 1, 0, 1, 2, 1, 0, 0, 2, 1, 0, 1, 2, 2, 0, 1, 0, 1, 0, 4, 4, 1, 0, 4, 4, 0, 0, 1, 6, 1, 0, 4, 6, 4, 0, 1, 6, 4, 0, 1, 6, 1, 0, 0, 8, 1, 0, 4, 0, 6, 0, 1, 0, 6, 0, 6, 8, 1, 0, 1, 10, 0, 0, 8, 6, 1, 0, 8, 6, 1, 0, 1, 10, 0, 0, 6, 6, 1, 0, 0, 12, 1, 0, 16
Offset: 1

Views

Author

Gus Wiseman, Apr 09 2025

Keywords

Comments

This described multiset (row n of A305936, Heinz number A181821) is generally not the same as the multiset of prime indices of n (A112798). For example, the prime indices of 12 are {1,1,2}, while a multiset whose multiplicities are {1,1,2} is {1,1,2,3}.

Examples

			The a(n) partitions for n = 6, 21, 30, 46:
  (1,1,2)  (1,1,1,1,2,2)  (1,1,1,2,2,3)  (1,1,1,1,1,1,1,1,1,2)
  (2,1,1)  (1,1,1,2,2,1)  (1,1,1,3,2,2)  (1,1,1,1,1,1,1,2,1,1)
           (1,2,2,1,1,1)  (2,2,1,1,1,3)  (1,1,1,1,1,1,2,1,1,1)
           (2,2,1,1,1,1)  (2,2,3,1,1,1)  (1,1,1,1,1,2,1,1,1,1)
                          (3,1,1,1,2,2)  (1,1,1,1,2,1,1,1,1,1)
                          (3,2,2,1,1,1)  (1,1,1,2,1,1,1,1,1,1)
                                         (1,1,2,1,1,1,1,1,1,1)
                                         (2,1,1,1,1,1,1,1,1,1)
		

Crossrefs

Positions of 1 are A008578.
For anti-run permutations we have A335125.
For just prime indices we have A382771, firsts A382772, equal A382857.
These permutations for factorials are counted by A382774, equal A335407.
For equal instead of distinct run-lengths we have A382858.
Positions of 0 are A382912, complement A382913.
A044813 lists numbers whose binary expansion has distinct run-lengths, equal A140690.
A055396 gives least prime index, greatest A061395.
A056239 adds up prime indices, row sums of A112798.
A098859 counts partitions with distinct multiplicities, ordered A242882.
A239455 counts Look-and-Say partitions, ranks A351294, conjugate A381432.
A329738 counts compositions with equal run-lengths, ranks A353744.
A329739 counts compositions with distinct run-lengths, ranks A351596.
A351293 counts non-Look-and-Say partitions, ranks A351295, conjugate A381433.

Programs

  • Mathematica
    nrmptn[n_]:=Join@@MapIndexed[Table[#2[[1]],{#1}]&,If[n==1,{},Flatten[Cases[FactorInteger[n]//Reverse,{p_,k_}:>Table[PrimePi[p],{k}]]]]];
    Table[Length[Select[Permutations[nrmptn[n]],UnsameQ@@Length/@Split[#]&]],{n,100}]

Formula

a(n) = A382771(A181821(n)) = A382771(A304660(n)).

A382858 Number of ways to permute a multiset whose multiplicities are the prime indices of n so that the run-lengths are all equal.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 6, 4, 0, 1, 6, 1, 0, 1, 24, 1, 12, 1, 2, 1, 0, 1, 36, 4, 0, 36, 0, 1, 10, 1, 120, 0, 0, 1, 84, 1, 0, 0, 24, 1, 3, 1, 0, 38, 0, 1, 240, 6, 18, 0, 0, 1, 246, 0, 6, 0, 0, 1, 96, 1, 0, 30, 720, 1, 0, 1, 0, 0, 14, 1, 660, 1, 0, 74, 0, 1, 0, 1
Offset: 1

Views

Author

Gus Wiseman, Apr 09 2025

Keywords

Comments

This described multiset (row n of A305936, Heinz number A181821) is generally not the same as the multiset of prime indices of n (A112798). For example, the prime indices of 12 are {1,1,2}, while a multiset whose multiplicities are {1,1,2} is {1,1,2,3}.

Examples

			The a(9) = 4 permutations are:
  (1,1,2,2)
  (1,2,1,2)
  (2,1,2,1)
  (2,2,1,1)
		

Crossrefs

The anti-run case is A335125.
These permutations for factorials are counted by A335407, distinct A382774.
For distinct instead of equal run-lengths we have A382773.
For prime indices we have A382857 (firsts A382878), distinct A382771 (firsts A382772).
Positions of 0 are A382914, signature restriction of A382915.
A003963 gives product of prime indices.
A140690 lists numbers whose binary expansion has equal run-lengths, distinct A044813.
A047966 counts partitions with equal multiplicities, distinct A098859.
A056239 adds up prime indices, row sums of A112798.
A304442 counts partitions with equal run-sums, ranks A353833.
A329738 counts compositions with equal run-lengths, ranks A353744.
A329739 counts compositions with distinct run-lengths, ranks A351596, complement A351291.
A382913 ranks Look-and-Say partitions by signature, complement A382912.

Programs

  • Mathematica
    nrmptn[n_]:=Join@@MapIndexed[Table[#2[[1]],{#1}]&,If[n==1,{},Flatten[Cases[FactorInteger[n]//Reverse,{p_,k_}:>Table[PrimePi[p],{k}]]]]];
    Table[Length[Select[Permutations[nrmptn[n]],SameQ@@Length/@Split[#]&]],{n,100}]

Formula

a(n) = A382857(A181821(n)) = A382857(A304660(n)).

A382878 Set of positions of first appearances in A382857 (permutations of prime indices with equal run-lengths).

Original entry on oeis.org

1, 6, 24, 30, 36, 180, 210, 360, 420, 720, 1080, 1260, 1800, 2160, 2310, 2520, 3600, 4620, 5040, 5400, 6300, 7560, 10800, 12600, 13860, 15120, 21600, 25200, 25920, 27000, 27720, 30030, 32400, 37800, 44100, 45360, 46656, 50400, 54000, 55440, 60060, 60480, 64800
Offset: 1

Views

Author

Gus Wiseman, Apr 09 2025

Keywords

Comments

A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798, sum A056239.

Examples

			The permutations for n = 6, 720, 36, 25920, 30:
  (1,2)  (1,2,1,2,1,3,1)  (1,1,2,2)  (1,2,1,2,1,2,1,2,1,3,1)  (1,2,3)
  (2,1)  (1,2,1,3,1,2,1)  (1,2,1,2)  (1,2,1,2,1,2,1,3,1,2,1)  (1,3,2)
         (1,3,1,2,1,2,1)  (2,1,2,1)  (1,2,1,2,1,3,1,2,1,2,1)  (2,1,3)
                          (2,2,1,1)  (1,2,1,3,1,2,1,2,1,2,1)  (2,3,1)
                                     (1,3,1,2,1,2,1,2,1,2,1)  (3,1,2)
                                                              (3,2,1)
The terms together with their prime indices begin:
      1: {}
      6: {1,2}
     24: {1,1,1,2}
     30: {1,2,3}
     36: {1,1,2,2}
    180: {1,1,2,2,3}
    210: {1,2,3,4}
    360: {1,1,1,2,2,3}
    420: {1,1,2,3,4}
    720: {1,1,1,1,2,2,3}
   1080: {1,1,1,2,2,2,3}
   1260: {1,1,2,2,3,4}
   1800: {1,1,1,2,2,3,3}
   2160: {1,1,1,1,2,2,2,3}
   2310: {1,2,3,4,5}
   2520: {1,1,1,2,2,3,4}
   3600: {1,1,1,1,2,2,3,3}
		

Crossrefs

Positions of first appearances in A382857 (zeros A382879), by signature A382858.
For distinct run-lengths we have A382772, firsts of A382771 (by signature A382773).
A140690 lists numbers whose binary expansion has equal run-lengths, distinct A044813.
A056239 adds up prime indices, row sums of A112798.
A239455 counts Look-and-Say partitions, ranks A351294, conjugate A381432.
A329738 counts compositions with equal run-lengths, ranks A353744.
A329739 counts compositions with distinct run-lengths, ranks A351596.
A351293 counts non-Look-and-Say partitions, ranks A351295, conjugate A381433.

Programs

  • Mathematica
    y=Table[Length[Select[Permutations[Join@@ConstantArray@@@FactorInteger[n]],SameQ@@Length/@Split[#]&]],{n,0,1000}];
    fip[y_]:=Select[Range[Length[y]],!MemberQ[Take[y,#-1],y[[#]]]&];
    fip[Rest[y]]

A382914 Numbers k such that it is not possible to permute a multiset whose multiplicities are the prime indices of k so that the run-lengths are all equal.

Original entry on oeis.org

10, 14, 22, 26, 28, 33, 34, 38, 39, 44, 46, 51, 52, 55, 57, 58, 62, 66, 68, 69, 74, 76, 78, 82, 85, 86, 87, 88, 92, 93, 94, 95, 102, 104, 106, 111, 114, 115, 116, 118, 119, 122, 123, 124, 129, 130, 134, 136, 138, 141, 142, 145, 146, 148, 152, 153, 155, 156
Offset: 1

Views

Author

Gus Wiseman, Apr 09 2025

Keywords

Comments

A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798, sum A056239.

Examples

			The terms together with their prime indices begin:
  10: {1,3}
  14: {1,4}
  22: {1,5}
  26: {1,6}
  28: {1,1,4}
  33: {2,5}
  34: {1,7}
  38: {1,8}
  39: {2,6}
  44: {1,1,5}
  46: {1,9}
  51: {2,7}
  52: {1,1,6}
  55: {3,5}
  57: {2,8}
  58: {1,10}
  62: {1,11}
  66: {1,2,5}
		

Crossrefs

For anti-run permutations we have A335126, complement A335127.
Zeros of A382858, anti-run A335125.
For prime indices instead of signature we have A382879, counted by A382915.
For distinct run-lengths we have A382912 (zeros of A382773), complement A382913.
A003963 gives product of prime indices.
A056239 adds up prime indices, row sums of A112798.
A140690 lists numbers whose binary expansion has equal run-lengths, distinct A044813.
A304442 counts partitions with equal run-sums, ranks A353833.
A164707 lists numbers whose binary form has equal runs of ones, distinct A328592.
A329738 counts compositions with equal run-lengths, ranks A353744.
A329739 counts compositions with distinct run-lengths, ranks A351596, complement A351291.
Cf. A382857 (firsts A382878), A382771 (firsts A382772).

Programs

  • Mathematica
    nrmptn[n_]:=Join@@MapIndexed[Table[#2[[1]],{#1}]&,If[n==1,{},Flatten[Cases[FactorInteger[n]//Reverse,{p_,k_}:>Table[PrimePi[p],{k}]]]]];
    Select[Range[100],Select[Permutations[nrmptn[#]],SameQ@@Length/@Split[#]&]=={}&]

A382772 Set of positions of first appearances in A382771 (permutations of prime indices with distinct run-lengths).

Original entry on oeis.org

1, 6, 12, 96, 360, 1536, 3456, 5184, 5760, 6144, 7776, 13824, 23040, 24576, 55296, 62208, 92160
Offset: 1

Views

Author

Gus Wiseman, Apr 09 2025

Keywords

Examples

			The permutations for n = 12, 96, 360, 1536:
  (1,1,2)  (1,1,1,1,1,2)  (1,1,1,2,2,3)  (1,1,1,1,1,1,1,1,1,2)
  (2,1,1)  (1,1,1,2,1,1)  (1,1,1,3,2,2)  (1,1,1,1,1,1,1,2,1,1)
           (1,1,2,1,1,1)  (2,2,1,1,1,3)  (1,1,1,1,1,1,2,1,1,1)
           (2,1,1,1,1,1)  (2,2,3,1,1,1)  (1,1,1,1,1,2,1,1,1,1)
                          (3,1,1,1,2,2)  (1,1,1,1,2,1,1,1,1,1)
                          (3,2,2,1,1,1)  (1,1,1,2,1,1,1,1,1,1)
                                         (1,1,2,1,1,1,1,1,1,1)
                                         (2,1,1,1,1,1,1,1,1,1)
		

Crossrefs

Positions of first appearances in A382771, by signature A382773.
For equal run-lengths we have A382878, firsts of A382857, zeros A382879.
A044813 lists numbers whose binary expansion has distinct run-lengths, equal A140690.
A055396 gives least prime index, greatest A061395.
A056239 adds up prime indices, row sums of A112798.
A098859 counts partitions with distinct multiplicities, ordered A242882.
A239455 counts Look-and-Say partitions, ranks A351294, conjugate A381432.
A328592 lists numbers whose binary form has distinct runs of ones, equal A164707.
A329738 counts compositions with equal run-lengths, ranks A353744.
A329739 counts compositions with distinct run-lengths, ranks A351596.
A351293 counts non-Look-and-Say partitions, ranks A351295, conjugate A381433.

Programs

  • Mathematica
    y=Table[Length[Select[Permutations[Join@@ConstantArray@@@FactorInteger[n]],UnsameQ@@Length/@Split[#]&]],{n,0,100000}];
    fip[y_]:=Select[Range[Length[y]],!MemberQ[Take[y,#-1],y[[#]]]&];
    fip[Rest[y]]

A382774 Number of ways to permute the prime indices of n! so that the run-lengths are all different.

Original entry on oeis.org

1, 1, 1, 0, 2, 0, 6, 0, 0, 0, 96, 0
Offset: 0

Views

Author

Gus Wiseman, Apr 09 2025

Keywords

Comments

A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798, sum A056239.

Examples

			The prime indices of 24 are {1,1,1,2}, with permutations (1,1,1,2) and (2,1,1,1), so a(4) = 2.
		

Crossrefs

For anti-run permutations we have A335407, see also A335125, A382858.
This is the restriction of A382771 to the factorials A000142, equal A382857.
A022559 counts prime indices of n!, sum A081401.
A044813 lists numbers whose binary expansion has distinct run-lengths, equal A140690.
A056239 adds up prime indices, row sums of A112798.
A098859 counts partitions with distinct multiplicities, ordered A242882.
A239455 counts Look-and-Say partitions, ranks A351294, conjugate A381432.
A328592 lists numbers whose binary form has distinct runs of ones, equal A164707.
A329738 counts compositions with equal run-lengths, ranks A353744.
A329739 counts compositions with distinct run-lengths, ranks A351596.
A351293 counts non-Look-and-Say partitions, ranks A351295, conjugate A381433.

Programs

  • Mathematica
    Table[Length[Select[Permutations[prix[n!]],UnsameQ@@Length/@Split[#]&]],{n,0,6}]

Formula

a(n) = A382771(n!).

A336962 Right-rotate run-lengths of consecutive equal digits in binary representation of n.

Original entry on oeis.org

0, 1, 2, 3, 6, 5, 4, 7, 14, 11, 10, 13, 12, 9, 8, 15, 30, 23, 22, 27, 26, 21, 20, 29, 28, 19, 18, 25, 24, 17, 16, 31, 62, 47, 46, 55, 54, 45, 44, 59, 58, 43, 42, 53, 52, 41, 40, 61, 60, 39, 38, 51, 50, 37, 36, 57, 56, 35, 34, 49, 48, 33, 32, 63, 126, 95, 94
Offset: 0

Views

Author

Rémy Sigrist, Aug 09 2020

Keywords

Comments

This sequence is a permutation of the nonnegative integers, with inverse A336963.

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     2      10         10
   3     3      11         11
   4     6     100        110
   5     5     101        101
   6     4     110        100
   7     7     111        111
   8    14    1000       1110
   9    11    1001       1011
  10    10    1010       1010
  11    13    1011       1101
  12    12    1100       1100
  13     9    1101       1001
  14     8    1110       1000
  15    15    1111       1111
		

Crossrefs

Programs

  • PARI
    toruns(n) = { my (r=[]); while (n, my (v=valuation(n+n%2,2)); n\=2^v; r=concat(v,r)); r }
    fromruns(r) = { my (v=0); for (k=1, #r, v=(v+k%2)*2^r[k]-k%2); v }
    a(n) = { my (r=toruns(n)); fromruns(vector(#r, k, r[1+(k-2)%#r])) }

Formula

a(n) = n iff n = 0 or n belongs to A140690.
Showing 1-10 of 12 results. Next