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

A357523 Reverse run lengths in binary expansions of terms of A166535: for n > 0, a(n) is the unique k such that A166535(k) = A056539(A166535(n)); a(0) = 0.

Original entry on oeis.org

0, 1, 2, 3, 6, 5, 4, 7, 14, 9, 10, 13, 12, 11, 8, 15, 20, 23, 24, 19, 16, 27, 26, 17, 18, 25, 22, 21, 40, 41, 46, 35, 32, 49, 50, 31, 36, 45, 42, 39, 28, 29, 38, 43, 44, 37, 30, 51, 48, 33, 34, 47, 88, 63, 62, 89, 94, 57, 68, 83, 80, 71, 54, 53, 72, 79, 84, 67
Offset: 0

Views

Author

Rémy Sigrist, Oct 02 2022

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			For n = 42:
- A166535(42) = 50,
- the binary expansion of 50 is "110010",
- reversing run lengths yields "101100",
- this corresponds to 44 = A166535(38),
- hence a(42) = 38.
		

Crossrefs

See A357522 for a similar sequence.

Programs

  • PARI
    See Links section.

Formula

a(n) = n iff n = 0 or A166535(n) belongs to A044918.

A063037 Numbers without 3 consecutive equal binary digits.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 18, 19, 20, 21, 22, 25, 26, 27, 36, 37, 38, 41, 42, 43, 44, 45, 50, 51, 52, 53, 54, 73, 74, 75, 76, 77, 82, 83, 84, 85, 86, 89, 90, 91, 100, 101, 102, 105, 106, 107, 108, 109, 146, 147, 148, 149, 150, 153, 154, 155, 164, 165, 166
Offset: 1

Views

Author

Lior Manor, Jul 05 2001

Keywords

Comments

Complement of A136037; intersection of A003796 and A003726. - Reinhard Zumkeller, Dec 11 2007
From Emeric Deutsch, Jan 27 2018: (Start)
Also 0 together with the indices of the compositions that have no parts larger than 2. For the definition of the index of a composition see A298644.
For example, 105 is in the sequence since its binary form is 1101001 and the composition [2,1,1,2,1] has no parts larger than 2.
On the other hand, 132 is not in the sequence since its binary form is 10000100 and the composition [1,4,1,2] has a part larger than 2.
The command c(n) from the Maple program yields the composition having index n. (End)
The sequence contains A000045(n+1) positive terms with binary length n. - Rémy Sigrist, Sep 30 2022

Examples

			The binary representation of 9 (1001) has no 3 consecutive equal digits.
		

Crossrefs

Programs

  • Maple
    isA063037 := proc(n)
        local bdgs,rep,d,i ;
        if n = 0 then
            return true;
        end if;
        bdgs := convert(n,base,2) ;
        rep := 1;
        d := op(1,bdgs) ;
        for i from 2 to nops(bdgs) do
            if op(i,bdgs) = op(i-1,bdgs) then
                rep := rep+1 ;
            else
                rep :=1 ;
            end if ;
            if rep > 2 then
                return false;
            end if;
        end do:
        return true ;
    end proc:
    for n from 0 to 50 do
        if isA063037(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, Dec 18 2013
    # Second Maple program:
    Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: for i from 2 to nops(L) do if L[i] = L[i-1] then r[j] := r[j], L[i] else j := j+1: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: A := {0}: for n to 250 do if `subset`(convert(c(n), set), {1, 2}) then A := `union`(A, {n}) else end if end do: A; # most of this Maple program is due to W. Edwin Clark. - Emeric Deutsch, Jan 27 2018
  • Mathematica
    Select[Range[0, 168], AllTrue[Length /@ Split@ IntegerDigits[#, 2], # < 3 &] &] (* Michael De Vlieger, Aug 20 2017 *)
  • PARI
    { n=0; for (m=0, 10^9, x=m; t=1; b=2; while (x>0, d=x-2*(x\2); x\=2; if (d==b, c++; if (c==3, t=x=0), b=d; c=1)); if (t, write("b063037.txt", n++, " ", m); if (n==1000, break)) ) } \\ Harry J. Smith, Aug 16 2009
    
  • PARI
    a(n) = { n--; if (n<=1, return (n), my (s=1); for (i=1, oo, my (f=fibonacci(i+1)); if (nRémy Sigrist, Sep 30 2022
    
  • Python
    from itertools import count, islice
    def A063037_gen(startvalue=0): # generator of terms >= startvalue
        return filter(lambda n: not ('000' in (s:=bin(n)[2:]) or '111' in s), count(max(0,startvalue)))
    A063037_list = list(islice(A063037_gen(),20)) # Chai Wah Wu, Oct 04 2022

Formula

It appears (but has not yet been proved) that the terms of {a(n)} can be computed recursively as follows. Let {c(i)} be defined for i >= 4 by c(i) = 2c(i-1) + 1, if i is a multiple of 3, else c(i) = 2c(i-1) - 1, with c(4) = 1. I.e., {c(i)} = {1,1,3,5,9,19,37,73,147,...}, for i=4,5,6,... . Let a(1)=1, a(2)=2, a(3)=3. For n > 3, choose k so that F(k)-2 < n <= F(k+1)-2, where F(k) denotes the k-th Fibonacci number (A000045). Then a(n) = c(k) + 2a(F(k)-2) - a(2F(k)-n-3). This has been verified for n up to 1100. - John W. Layman, May 26 2009

Extensions

Missing "less than" sign supplied in the conjectured recurrence (thanks to Franklin T. Adams-Watters for pointing this out) by John W. Layman, Nov 09 2009

A179970 Numbers such that in base-4 representation all sums of two adjacent digits are odd.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 9, 11, 12, 14, 17, 19, 25, 27, 36, 38, 44, 46, 49, 51, 57, 59, 68, 70, 76, 78, 100, 102, 108, 110, 145, 147, 153, 155, 177, 179, 185, 187, 196, 198, 204, 206, 228, 230, 236, 238, 273, 275, 281, 283, 305, 307, 313, 315, 401, 403, 409, 411, 433, 435
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 04 2010

Keywords

Comments

If m is a term with m mod 4 < 2 then is also m+2 a term;
0 <= a(2*n-1) mod 4 <= 1 and 2 <= a(2*n) mod 4 <= 3;
a(n) mod 2 = 1 - a(floor((n-1)/2)) mod 2;
a(n) mod 4 = a(n) mod 2 + 2*(1 - n mod 2);
floor(a(n)/4) = a(floor((n-1)/2));
in binary representation there are no runs of more than 3 zeros or 3 ones: subsequence of A166535.

Examples

			a(10)=14->base4:32->base2:1110;
a(100)=1126->base4:101212->base2:10001100110;
a(1000)=113043->base4:123212103->base2:11011100110010011.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[0,500],And@@OddQ[Total/@Partition[IntegerDigits[#,4],2,1]]&] (* Harvey P. Dale, Aug 19 2012 *)

Formula

Let m = a(floor((n-1)/2)), then for n > 3:
a(n) = 4*m - m mod 2 + 1 + 2*(1 - n mod 2).

A344022 Numbers with binary expansion (b_1, ..., b_m) such that bending a strip of paper of length k+1 with an angle of +90 degrees (resp. -90 degrees) at position X=k when b_k = 1 (resp. b_k = 0) for k = 1..m yields a configuration where all edges are distinct.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 81, 82, 83, 84, 85
Offset: 1

Views

Author

Rémy Sigrist, May 07 2021

Keywords

Comments

All positive terms belong to A166535, but the reverse is not true (for example, A166535(96) = 136 does not belong to this sequence).
This sequence is infinite as it contains A000975 and A343183.
If m belongs to the sequence, then floor(m/2) also belongs to the sequence.
For any k > 0, the sequence contains A006744(k) positive terms with k binary digits.
This sequence has connections with A258002, A255561 and A255571: these sequences encode in binary nonoverlapping or noncrossing paths in the honeycomb lattice.

Examples

			See illustration in Links section.
		

Crossrefs

Programs

  • PARI
    is(n) = { my (b=binary(n), d=1, s=[d], z=2*d); for (k=1, #b, if (b[k], d*=I, d/=I); if (setsearch(s, z+=d), return (0), s=setunion(s, [z]); z+=d)); return (1) }
Showing 1-4 of 4 results.