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-7 of 7 results.

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

A304101 Restricted growth sequence transform of A278222(A048679(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 13 2018

Keywords

Comments

Positions of 2's is given by the positive Fibonacci numbers: 1, 2, 3, 5, 8, 13, 21, ..., that is, A000045(n) from n >= 2 onward.
Positions of 3's is given by Lucas numbers larger than 3: 4, 7, 11, 18, ..., that is, A000032(n) from n >= 3 onward.
Sequence allots a distinct value for each distinct multiset formed from the lengths of 1-runs in the binary representation of A048679(n). Compare to the scatter plot of A286622.

Crossrefs

Cf. also A286622 (compare the scatter-plots).

Programs

  • PARI
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    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); }
    A106151(n) = if(n<=1, n, if(n%2, 1+(2*A106151((n-1)/2)), A106151(n>>valuation(n, 2))<<(valuation(n, 2)-1)));
    A048679(n) = if(!n,n,A106151(2*A003714(n)));
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t };
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ From A046523
    A278222(n) = A046523(A005940(1+n));
    v304101 = rgs_transform(vector(1+up_to, n, A278222(A048679(n-1))));
    A304101(n) = v304101[1+n];

A175047 Write n in binary, then increase each run of 0's by one 0. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

1, 4, 3, 8, 9, 12, 7, 16, 17, 36, 19, 24, 25, 28, 15, 32, 33, 68, 35, 72, 73, 76, 39, 48, 49, 100, 51, 56, 57, 60, 31, 64, 65, 132, 67, 136, 137, 140, 71, 144, 145, 292, 147, 152, 153, 156, 79, 96, 97, 196, 99, 200, 201, 204, 103, 112, 113, 228, 115, 120, 121, 124, 63, 128
Offset: 1

Views

Author

Leroy Quet, Dec 02 2009

Keywords

Comments

From Reinhard Zumkeller, Dec 12 2009: (Start)
A070939(a(n)) = A070939(n) + A033264(n);
A171598 and A171599 give record values and where they occur. (End)

Examples

			12 in binary is 1100. Increase each run of 0 by one digit to get 11000, which is 24 in decimal. So a(12) = 24.
		

Crossrefs

Programs

  • Haskell
    import Data.List (group)
    a175047 = foldr (\b v -> 2 * v + b) 0 . concatMap
       (\bs@(b:_) -> if b == 0 then 0 : bs else bs) . group . a030308_row
    -- Reinhard Zumkeller, Jul 05 2013
    
  • Mathematica
    f[n_] := Block[{s = Split@ IntegerDigits[n, 2]}, FromDigits[ Flatten@ Insert[s, {0}, Table[{2 i}, {i, Floor[ Length@s/2]} ]], 2]]; Array[ f, 64] (* Robert G. Wilson v, Dec 11 2009 *)
  • Python
    from re import split
    def A175047(n):
      return int(''.join(d+'0' if '0' in d else d for d in split('(0+)|(1+)',bin(n)[2:]) if d != '' and d != None),2) # Chai Wah Wu, Nov 21 2018

Formula

a(n) = if n<2 then n else 2*(1 + 0^((n+2) mod 4))*a([n/2]) + n mod 2. - Reinhard Zumkeller, Jan 20 2010
a(2^n) = 2^(n+1). - Chai Wah Wu, Nov 21 2018

Extensions

Extended by Ray Chandler, Dec 18 2009
a(11) onwards from Robert G. Wilson v and Reinhard Zumkeller, Dec 11 2009

A348710 In the binary expansion of n, decrease the length of each run of 1-bits by one.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 2, 3, 0, 0, 0, 1, 4, 2, 6, 7, 0, 0, 0, 1, 0, 0, 2, 3, 8, 4, 4, 5, 12, 6, 14, 15, 0, 0, 0, 1, 0, 0, 2, 3, 0, 0, 0, 1, 4, 2, 6, 7, 16, 8, 8, 9, 8, 4, 10, 11, 24, 12, 12, 13, 28, 14, 30, 31, 0, 0, 0, 1, 0, 0, 2, 3, 0, 0, 0, 1, 4, 2, 6, 7, 0, 0, 0
Offset: 0

Views

Author

Kevin Ryde, Oct 30 2021

Keywords

Comments

Equivalently, change bits 01 -> 0, including a 0 reckoned above the most significant 1-bit of n so change there.
A single 1-bit run decreases to nothing. The Fibbinary numbers (A003714) are those n with only single 1-bits so that a(n) = 0 iff n is in A003714.
a(n) = 1 iff n is in A213540 since those values end with bits 011 (which become 01) and otherwise have only single 1-bits, as do the Fibbinary numbers.
Decreasing each run is the inverse of the increase A175048 so that a(A175048(k)) = k. This n = A175048(k) is the smallest n with a(n) = k and then other occurrences of k are by inserting single 1-bits into this n, including anywhere above the most significant bit.

Examples

			n    = 14551 = binary 111 000 11 0 1 0 111
a(n) =   787 = binary  11 000  1 0   0  11
		

Crossrefs

Cf. A007088 (binary), A175048 (increase 1-bits), A090077 (decrease to single 1-bits).
Cf. A003714 (indices of 0's), A213540 (indices of 1's).
Cf. A106151 (decrease 0-bits), A318921 (decrease each run).

Programs

  • Mathematica
    Table[FromDigits[Flatten[Split@IntegerDigits[n,2]/. {1,a___}:>{a}],2],{n,0,82}] (* Giorgos Kalogeropoulos, Nov 01 2021 *)
  • PARI
    a(n) = my(v=binary(n),t=0); for(i=2,#v, if(v[i-1]||!v[i], v[t++]=v[i])); fromdigits(v[1..t],2);
    
  • Python
    def a(n): return int(bin(n).replace("b", "").replace("01", "0"), 2)
    print([a(n) for n in range(83)]) # Michael S. Branicky, Oct 31 2021

A227351 Permutation of nonnegative integers: map each number by lengths of runs of zeros in its Zeckendorf expansion shifted once left to the number which has the same lengths of runs (in the same order, but alternatively of runs of 0's and 1's) in its binary representation.

Original entry on oeis.org

0, 1, 3, 7, 2, 15, 6, 4, 31, 14, 12, 8, 5, 63, 30, 28, 24, 13, 16, 9, 11, 127, 62, 60, 56, 29, 48, 25, 27, 32, 17, 19, 23, 10, 255, 126, 124, 120, 61, 112, 57, 59, 96, 49, 51, 55, 26, 64, 33, 35, 39, 18, 47, 22, 20, 511, 254, 252, 248, 125, 240, 121, 123, 224
Offset: 0

Views

Author

Antti Karttunen, Jul 08 2013

Keywords

Comments

This permutation is based on the fact that by appending one extra zero to the right of Fibonacci number representation of n (aka "Zeckendorf expansion") and then counting the lengths of blocks of consecutive (nonleading) zeros we get bijective correspondence with compositions, and thus also with the binary representation of a unique n. See the chart below:
n A014417(n) A014417(A022342(n+1)) Runs of Binary number In dec.
[shifted once left] zeros with same runs = a(n)
0: ......0 ......0 [] .....0 0
1: ......1 .....10 [1] .....1 1
2: .....10 ....100 [2] ....11 3
3: ....100 ...1000 [3] ...111 7
4: ....101 ...1010 [1,1] ....10 2
5: ...1000 ..10000 [4] ..1111 15
6: ...1001 ..10010 [2,1] ...110 6
7: ...1010 ..10100 [1,2] ...100 4
8: ..10000 .100000 [5] .11111 31
9: ..10001 .100010 [3,1] ..1110 14
10: ..10010 .100100 [2,2] ..1100 12
11: ..10100 .101000 [1,3] ..1000 8
12: ..10101 .101010 [1,1,1] ...101 5
13: .100000 1000000 [6] 111111 63
Are there any other fixed points after 0, 1, 6, 803, 407483 ?

Crossrefs

Inverse permutation: A227352. Cf. also A003714, A014417, A006068, A048679.
Could be further composed with A075157 or A075159, also A129594.

Programs

Formula

a(n) = A006068(A048679(n)) = A006068(A106151(2*A003714(n))).
This permutation effects following correspondences:
a(A000045(n)) = A000225(n-1).
a(A027941(n)) = A000975(n).
For n >=3, a(A000204(n)) = A000079(n-2).

A304100 a(n) = A003602(A048679(n)).

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 2, 1, 5, 3, 2, 4, 1, 9, 5, 3, 6, 2, 7, 4, 1, 17, 9, 5, 10, 3, 11, 6, 2, 13, 7, 4, 8, 1, 33, 17, 9, 18, 5, 19, 10, 3, 21, 11, 6, 12, 2, 25, 13, 7, 14, 4, 15, 8, 1, 65, 33, 17, 34, 9, 35, 18, 5, 37, 19, 10, 20, 3, 41, 21, 11, 22, 6, 23, 12, 2, 49, 25, 13, 26, 7, 27, 14, 4, 29, 15, 8, 16, 1, 129, 65, 33, 66, 17, 67, 34, 9, 69, 35, 18, 36, 5, 73
Offset: 1

Views

Author

Antti Karttunen, May 13 2018

Keywords

Comments

Positions of ones is given by the positive Fibonacci numbers: 1, 2, 3, 5, 8, 13, 21, ..., that is, A000045(n) from n >= 2 onward.
Positions of 2's is given by Lucas numbers larger than 3: 4, 7, 11, 18, ..., that is, A000032(n) from n >= 3 onward.
The restricted growth sequence transform of this sequence (almost certainly) is A003603.

Crossrefs

Programs

Formula

a(n) = A003602(A048679(n)).
For all i, j: a(i) = a(j) => A304101(i) = A304101(j).

A374201 Lexicographically earliest infinite sequence such that a(i) = a(j) => A278222(A048679(A328845(i))) = A278222(A048679(A328845(j))), for all i, j >= 1, where A328845 is a Fibonacci-based variant of the arithmetic derivative.

Original entry on oeis.org

1, 1, 2, 2, 3, 2, 3, 2, 4, 4, 5, 2, 4, 2, 6, 7, 4, 2, 6, 2, 8, 9, 10, 2, 4, 7, 8, 6, 11, 2, 8, 2, 11, 8, 12, 7, 4, 2, 12, 13, 7, 2, 11, 2, 8, 8, 13, 2, 7, 10, 7, 8, 14, 2, 15, 7, 13, 12, 10, 2, 8, 2, 12, 7, 10, 13, 5, 2, 16, 17, 5, 2, 7, 2, 13, 7, 15, 16, 18, 2, 7, 18, 12, 2, 8, 19, 20, 13, 7, 2, 8, 18, 16, 12, 10, 21, 13, 2, 8, 9, 16
Offset: 0

Views

Author

Antti Karttunen, Jul 02 2024

Keywords

Comments

Restricted growth sequence transform of A278222(A048679(A328845(n))), or equally, of A304101(A328845(n)).
Related to the Zeckendorf-representation (A014417) of A328845(n).
For all i, j >= 0: a(i) = a(j) => A328847(i) = A328847(j).

Crossrefs

Programs

  • PARI
    up_to = 75025;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    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); }
    A106151(n) = { my(s=0, i=0); while(n, if(2!=(n%4), s += (n%2)<>= 1); (s); };
    A048679(n) = if(!n,n,A106151(2*A003714(n)));
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t };
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };
    A278222(n) = A046523(A005940(1+n));
    A328845(n) = if(n<=1, 0, my(f=factor(n)); n*sum(i=1, #f~, f[i, 2]*fibonacci(f[i,1])/f[i, 1]));
    v374201 = rgs_transform(vector(1+up_to, n, A278222(A048679(A328845(n-1)))));
    A374201(n) = v374201[1+n];
Showing 1-7 of 7 results.