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

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

A022340 Even Fibbinary numbers (A003714); also 2*Fibbinary(n).

Original entry on oeis.org

0, 2, 4, 8, 10, 16, 18, 20, 32, 34, 36, 40, 42, 64, 66, 68, 72, 74, 80, 82, 84, 128, 130, 132, 136, 138, 144, 146, 148, 160, 162, 164, 168, 170, 256, 258, 260, 264, 266, 272, 274, 276, 288, 290, 292, 296, 298, 320, 322, 324, 328, 330, 336, 338, 340, 512
Offset: 0

Views

Author

Keywords

Comments

Positions of ones in binomial(3k+2,k+1)/(3k+2) modulo 2 (A085405). - Paul D. Hanna, Jun 29 2003
Construction: start with strings S(0)={0}, S(1)={2}; for k>=2, concatenate all prior strings excluding S(k-1) and add 2^k to each element in the resulting string to obtain S(k); this sequence is the concatenation of all such generated strings: {S(0),S(1),S(2),...}. Example: for k=5, concatenate {S(0),S(1),S(2),S(3)} = {0, 2, 4, 8,10}; add 2^5 to each element to obtain S(5)={32,34,38,40,42}. - Paul D. Hanna, Jun 29 2003
From Gus Wiseman, Apr 08 2020: (Start)
The k-th composition in standard order (row k of 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. This sequence lists all numbers k such that the k-th composition in standard order has no ones. For example, the sequence together with the corresponding compositions begins:
0: () 80: (2,5) 260: (6,3)
2: (2) 82: (2,3,2) 264: (5,4)
4: (3) 84: (2,2,3) 266: (5,2,2)
8: (4) 128: (8) 272: (4,5)
10: (2,2) 130: (6,2) 274: (4,3,2)
16: (5) 132: (5,3) 276: (4,2,3)
18: (3,2) 136: (4,4) 288: (3,6)
20: (2,3) 138: (4,2,2) 290: (3,4,2)
32: (6) 144: (3,5) 292: (3,3,3)
34: (4,2) 146: (3,3,2) 296: (3,2,4)
36: (3,3) 148: (3,2,3) 298: (3,2,2,2)
40: (2,4) 160: (2,6) 320: (2,7)
42: (2,2,2) 162: (2,4,2) 322: (2,5,2)
64: (7) 164: (2,3,3) 324: (2,4,3)
66: (5,2) 168: (2,2,4) 328: (2,3,4)
68: (4,3) 170: (2,2,2,2) 330: (2,3,2,2)
72: (3,4) 256: (9) 336: (2,2,5)
74: (3,2,2) 258: (7,2) 338: (2,2,3,2)
(End)

Crossrefs

Equals 2 * A003714.
Compositions with no ones are counted by A212804.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Compositions without terms > 2 are A003754.
- Compositions without ones are A022340 (this sequence).
- Sum is A070939.
- Compositions with no twos are A175054.
- Strict compositions are A233564.
- Constant compositions are A272919.
- Normal compositions are A333217.
- Runs-resistance is A333628.

Programs

  • Haskell
    a022340 = (* 2) . a003714 -- Reinhard Zumkeller, Feb 03 2015
    
  • Mathematica
    f[n_Integer] := Block[{k = Ceiling[ Log[ GoldenRatio, n*Sqrt[5]]], t = n, fr = {}}, While[k > 1, If[t >= Fibonacci[k], AppendTo[fr, 1]; t = t - Fibonacci[k], AppendTo[fr, 0]]; k-- ]; FromDigits[fr, 2]]; Select[f /@ Range[0, 95], EvenQ[ # ] &] (* Robert G. Wilson v, Sep 18 2004 *)
    Select[Range[2, 512, 2], BitAnd[#, 2#] == 0 &] (* Alonso del Arte, Jun 18 2012 *)
  • Python
    from itertools import count, islice
    def A022340_gen(startvalue=0): # generator of terms >= startvalue
        return filter(lambda n:not n&(n>>1),count(max(0,startvalue+(startvalue&1)),2))
    A022340_list = list(islice(A022340_gen(),30)) # Chai Wah Wu, Sep 07 2022
    
  • Python
    def A022340(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
            s <<= 1
        return s # Chai Wah Wu, Apr 24 2025

Formula

For n>0, a(F(n))=2^n, a(F(n)-1)=A001045(n+2)-1, where F(n) is the n-th Fibonacci number with F(0)=F(1)=1.
a(n) + a(n)/2 = a(n) XOR a(n)/2, see A106409. - Reinhard Zumkeller, May 02 2005

Extensions

Edited by Ralf Stephan, Sep 01 2004

A374356 a(n) is the greatest fibbinary number f <= n such that n - f is also a fibbinary number whose binary expansion has no common 1's with that of f (where fibbinary numbers correspond to A003714).

Original entry on oeis.org

0, 1, 2, 2, 4, 5, 4, 5, 8, 9, 10, 10, 8, 9, 10, 10, 16, 17, 18, 18, 20, 21, 20, 21, 16, 17, 18, 18, 20, 21, 20, 21, 32, 33, 34, 34, 36, 37, 36, 37, 40, 41, 42, 42, 40, 41, 42, 42, 32, 33, 34, 34, 36, 37, 36, 37, 40, 41, 42, 42, 40, 41, 42, 42, 64, 65, 66, 66
Offset: 0

Views

Author

Rémy Sigrist, Jul 06 2024

Keywords

Comments

To compute a(n): replace every other bit with zero (starting with the second bit) in each run of consecutive 1's in the binary expansion of n.
From Gus Wiseman, Jul 11 2025: (Start)
This is the greatest binary rank of a sparse subset of the binary indices of n, where:
1. The binary indices of a nonnegative integer are the positions of 1 in its reversed binary expansion.
2. A set is sparse iff 1 is not a first difference.
3. The binary rank of a set {S_1,S_2,...} is Sum_i 2^(S_i-1).
(End)

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     2      11         10
   4     4     100        100
   5     5     101        101
   6     4     110        100
   7     5     111        101
   8     8    1000       1000
   9     9    1001       1001
  10    10    1010       1010
  11    10    1011       1010
  12     8    1100       1000
  13     9    1101       1001
  14    10    1110       1010
  15    10    1111       1010
  16    16   10000      10000
		

Crossrefs

The union is A003714 (Fibbinary numbers).
For prime instead of binary indices we have A385216.
A034839 counts subsets by number of maximal runs, for strict partitions A116674.
A166469 counts sparse submultisets of prime indices, maximal A385215.
A245564 counts sparse subsets of binary indices, maximal case A384883.
A319630 ranks sparse submultisets of prime indices, complement A104210.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    fbi[q_]:=If[q=={},0,Total[2^q]/2];
    Table[Max@@fbi/@Select[Subsets[bpe[n]],FreeQ[Differences[#],1]&],{n,0,100}] (* Gus Wiseman, Jul 11 2025 *)
  • PARI
    a(n) = { my (v = 0, e, x, y, b); while (n, x = y = 0; e = valuation(n, 2); for (k = 0, oo, if (bittest(n, e+k), n -= b = 2^(e+k); [x, y] = [y + b, x], v += x; break;););); return (v); }

Formula

a(n) = A374354(n, A277561(n)-1).
a(n) = n - A374355(n).
a(n) <= n with equality iff n is a fibbinary number.

A277335 Fibbinary numbers multiplied by three: a(n) = 3*A003714(n); Numbers where all 1-bits occur in runs of even length.

Original entry on oeis.org

0, 3, 6, 12, 15, 24, 27, 30, 48, 51, 54, 60, 63, 96, 99, 102, 108, 111, 120, 123, 126, 192, 195, 198, 204, 207, 216, 219, 222, 240, 243, 246, 252, 255, 384, 387, 390, 396, 399, 408, 411, 414, 432, 435, 438, 444, 447, 480, 483, 486, 492, 495, 504, 507, 510, 768, 771, 774, 780, 783, 792, 795, 798, 816, 819, 822, 828, 831, 864, 867, 870, 876, 879, 888
Offset: 0

Views

Author

Antti Karttunen, Oct 18 2016

Keywords

Comments

The positive entries are the viabin numbers of integer partitions into even parts. The viabin number of an integer partition is defined in the following way. Consider the southeast border of the Ferrers board of the integer partition and consider the binary number obtained by replacing each east step with 1 and each north step, except the last one, with 0. The corresponding decimal form is, by definition, the viabin number of the given integer partition. "Viabin" is coined from "via binary". For example, consider the integer partition [6,4,4,2]. The southeast border of its Ferrers board yields 110110011, leading to the viabin number 435 (a term of the sequence). - Emeric Deutsch, Sep 11 2017

Crossrefs

Cf. A003714.
Positions of odd terms in A106737.
Cf. also A001196 (a subsequence).

Programs

  • Mathematica
    3 Select[Range[300], BitAnd[#, 2 #]==0 &] (* Vincenzo Librandi, Sep 12 2017 *)
  • Python
    def A277335(n):
        tlist, s = [1,2], 0
        while tlist[-1]+tlist[-2] <= n: tlist.append(tlist[-1]+tlist[-2])
        for d in tlist[::-1]:
            s <<= 1
            if d <= n:
                s += 1
                n -= d
        return 3*s # Chai Wah Wu, Apr 24 2025
  • Scheme
    (define (A277335 n) (* 3 (A003714 n)))
    

Formula

a(n) = 3*A003714(n).

A022341 a(n) = 4*A003714(n) + 1; the odd Fibbinary numbers.

Original entry on oeis.org

1, 5, 9, 17, 21, 33, 37, 41, 65, 69, 73, 81, 85, 129, 133, 137, 145, 149, 161, 165, 169, 257, 261, 265, 273, 277, 289, 293, 297, 321, 325, 329, 337, 341, 513, 517, 521, 529, 533, 545, 549, 553, 577, 581, 585, 593, 597, 641, 645, 649, 657, 661, 673, 677, 681
Offset: 0

Views

Author

Keywords

Comments

Numbers k such that (k+1) does not divide C(3k, k) - C(2k, k). - Benoit Cloitre, May 23 2004
Each term is the unique odd number a(n) = Sum_{i in S} 2^i such that n = Sum_{i in S} F_i, where F_i is the i-th Fibonacci number, A000045(i), and S is a set of nonnegative integers of which no two are adjacent. Note that this corresponds to adding F_0 to the Zeckendorf representation of n, which does not change the number being represented, because F_0 = 0. - Peter Munn, Sep 02 2022

Crossrefs

First column of A356875.

Programs

  • Maple
    F:= combinat[fibonacci]:
    b:= proc(n) local j;
          if n=0 then 0
        else for j from 2 while F(j+1)<=n do od;
             b(n-F(j))+2^(j-2)
          fi
        end:
    a:= n-> 4*b(n)+1:
    seq(a(n), n=0..70);  # Alois P. Heinz, May 15 2016
  • Mathematica
    Select[Range[1, 511, 2], BitAnd[#, 2#] == 0 &] (* Alonso del Arte, Jun 18 2012 *)
  • Python
    for n in range(1, 700, 2):
        if n*2 & n == 0:
            print(n, end=',')
    
  • Python
    def A022341(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
            s <<= 1
        return (s<<1)|1 # Chai Wah Wu, Apr 24 2025
    
  • Scala
    (1 to 511 by 2).filter(n => (n & 2 * n) == 0) // Alonso del Arte, Apr 12 2020
    (C#)
    public static bool IsOddFibbinaryNum(this int n) => ((n & (n >> 1)) == 0) && (n % 2 == 1) ? true : false; // Frank Hollstein, Jul 07 2021

Extensions

More terms from Benoit Cloitre, May 23 2004 and Alonso del Arte, Jun 18 2012
Name edited by Peter Munn, Sep 02 2022

A266121 Lexicographically first injection of natural numbers beginning with a(1)=1 such that 1+(a(n)*a(n+1)) is a fibbinary number (A003714), i.e., has no adjacent 1's in its base-2 representation.

Original entry on oeis.org

1, 3, 5, 4, 2, 8, 9, 7, 12, 6, 14, 24, 11, 13, 20, 16, 10, 26, 40, 17, 15, 39, 28, 19, 27, 25, 23, 48, 22, 30, 44, 31, 33, 32, 18, 36, 29, 47, 45, 52, 21, 55, 49, 84, 61, 43, 51, 53, 80, 34, 64, 37, 35, 59, 75, 117, 93, 91, 57, 41, 100, 82, 50, 104, 42, 98, 106, 90, 114, 72, 58, 144, 65, 63, 151, 56, 38, 54, 76, 71, 60
Offset: 1

Views

Author

Antti Karttunen, Dec 23 2015

Keywords

Comments

It is conjectured that this sequence is not only injective, but also surjective on N, i.e., that it is a true permutation of natural numbers.
A similar sequence, but with condition that "(a(n)*a(n+1)) must be a member of A003714" yields a sequence: 1, 2, 4, 5, 8, 9, 16, 10, 13, 20, ... (A269361) which certainly is not a bijection, because it contains only terms of A091072.
Also, with above condition and the initial value a(1) = 3 the algorithm generates A269363 which contains only terms of A091067. See also A266191.

Examples

			After the initial a(1) = 1, for obtaining the value of a(2) we try the first unused number, which is 2, but (1*2)+1 = 3, which in binary is "11", thus 2 is not qualified at this point of time. So next we try 3, and (1*3)+1 = 4, which in binary is "100", and that satisfies our criterion (no adjacent 1-bits), thus we set a(2) = 3.
For a(3), we test with the least unused numbers 2, 4, 5, etc., yielding products (3*2)+1 = 7 = "111", (3*4)+1 = 13 = "1101" and (3*5)+1 = 16 = "10000" in binary, and only 5 satisfies the criterion, thus we set a(3) = 5.
		

Crossrefs

Left inverse: A266122 (also the right inverse if this sequence is a permutation of natural numbers).
Cf. also A266191 and A266117 for similar permutations.

Extensions

Minor typo in the description corrected by Antti Karttunen, Feb 25 2016

A266191 Sequence beginning with a(1)=1, a(2)=2, a(3)=3 and then after each new term a(n) is selected as the least unused number for which a(n)*a(n-1)*a(n-2) is a fibbinary number (A003714), i.e., has no adjacent 1's in its base-2 representation.

Original entry on oeis.org

1, 2, 3, 6, 4, 7, 12, 8, 11, 15, 16, 22, 24, 5, 39, 14, 10, 59, 28, 20, 67, 31, 9, 63, 19, 18, 27, 38, 17, 54, 47, 34, 44, 51, 33, 88, 30, 32, 43, 48, 21, 86, 23, 42, 35, 46, 84, 70, 91, 168, 71, 55, 36, 75, 99, 40, 135, 110, 41, 60, 111, 80, 120, 62, 160, 134, 56, 141, 76, 112, 64, 78, 119, 113, 103, 183, 37, 167, 366, 73
Offset: 1

Views

Author

Antti Karttunen, Dec 23 2015

Keywords

Comments

It is conjectured that this sequence is not only injective, but also surjective on N, i.e., that it is a true permutation of natural numbers.
See also comments in related A266121.

Examples

			For n=4, we start testing from the least so far unused number, which is 4, by multiplying it by a(3)*a(2) = 6. Because 6*4 = 24, which has two adjacent 1's in its binary representation "11000", 6 is disqualified. Next we try 5, and 6*5 = "11110", and 5 is also disqualified. Next we try 6, and 6*6 = "100100", with no adjacent 1's, and we have found the least unused number satisfying the required condition, thus we set a(4) = 6.
		

Crossrefs

Left inverse: A266192 (also the right inverse if this sequence is a permutation of natural numbers).
Cf. also A266117, A266121 and A266195 for similar permutations.

A277006 a(n) = A005940(1+A003714(n)); permutation of squarefree numbers.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 10, 15, 11, 14, 21, 35, 30, 13, 22, 33, 55, 42, 77, 70, 105, 17, 26, 39, 65, 66, 91, 110, 165, 143, 154, 231, 385, 210, 19, 34, 51, 85, 78, 119, 130, 195, 187, 182, 273, 455, 330, 221, 286, 429, 715, 462, 1001, 770, 1155, 23, 38, 57, 95, 102, 133, 170, 255, 209, 238, 357, 595, 390, 247, 374, 561, 935, 546, 1309, 910, 1365, 323
Offset: 0

Views

Author

Antti Karttunen, Oct 07 2016

Keywords

Comments

Permutation of A005117 (squarefree numbers).

Crossrefs

Programs

Formula

a(n) = A005940(1+A003714(n)).
Other identities.
For n >= 0, A048675(a(n)) = A087808(A003714(n)) = A048679(n).
For n >= 1, a(A000045(n+1)) = A000040(n).

A269361 Lexicographically first injection of natural numbers beginning with a(1)=1 such that a(n)*a(n+1) is a fibbinary number (A003714), i.e., has no adjacent 1's in its base-2 representation.

Original entry on oeis.org

1, 2, 4, 5, 8, 9, 16, 10, 13, 20, 17, 32, 18, 29, 36, 33, 40, 26, 21, 49, 42, 52, 25, 41, 50, 82, 57, 45, 53, 80, 34, 64, 37, 113, 74, 125, 84, 61, 72, 58, 73, 65, 68, 69, 128, 66, 129, 132, 133, 77, 114, 81, 117, 90, 104, 85, 98, 89, 93, 100, 105, 161, 106, 97, 169, 122, 137, 157, 138, 136, 121, 141, 149, 221, 153, 109, 160, 116, 144
Offset: 1

Views

Author

Antti Karttunen, Feb 25 2016

Keywords

Comments

The sequence is conjectured to be a permutation of A091072.

Crossrefs

A269363 Lexicographically first injection of natural numbers beginning with a(1)=3 such that for all n >= 1, a(n)*a(n+1) is a fibbinary number (A003714), i.e., has no adjacent 1's in its base-2 representation.

Original entry on oeis.org

3, 6, 7, 12, 11, 15, 22, 24, 14, 19, 27, 38, 28, 23, 46, 48, 43, 30, 39, 35, 59, 44, 31, 75, 62, 87, 51, 83, 56, 47, 88, 54, 76, 55, 96, 86, 60, 71, 67, 70, 78, 112, 79, 107, 102, 91, 120, 139, 118, 140, 119, 142, 131, 134, 155, 240, 156, 135, 152, 108, 95, 92, 103, 179, 184, 115, 147, 224, 94, 175, 123, 150, 111, 158, 214, 163, 203
Offset: 1

Views

Author

Antti Karttunen, Feb 25 2016

Keywords

Comments

The sequence is conjectured to be a permutation of A091067.
The scatter plot is quite interesting (essentially the same as A269367). Compare also to the graph of A269361.

Crossrefs

Cf. A269367 (the terms ranked with A255070).

Programs

  • Mathematica
    fibbinaryQ[n_] := BitAnd[n, 2 n]==0; a[1]=3; a[n_] := a[n] = For[k=1, True, k++, If[Mod[k, 4] != 1, If[fibbinaryQ[a[n-1] k], If[FreeQ[Array[a, n-1], k], Return[k]]]]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Mar 02 2016 *)
Showing 1-10 of 236 results. Next