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

A358733 Permutation of the nonnegative integers such that A358654(p(n) - 1) = A200714(n) for n > 0 where p(n) is described in Comments.

Original entry on oeis.org

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

Views

Author

Mikhail Kurkov, Mar 13 2023 [verification needed]

Keywords

Comments

Here p(n) = n + a(d(n)) - d(n) for n > 0 where d(n) = c(b(n)), b(n) = f(g(n) + 2) - n - 1 for n > 0 with b(0) = 0, c(n) = f(g(n) + 3) - n - 1 for n > 0 with c(0) = 0, f(n) = A000045(n) and where g(n) = A072649(n). To compute p(n) we need to know a(d(n)) and to compute a(n) we need to know p(e(n)) where e(n) = n - f(g(n) + 1) for n > 0 with e(0) = 0 in the sense that we can rewrite a(n) = n + [e(n) > 0]*(a(h(n)) - h(n) ...) (here h(n) = d(e(n))) as a(n) = n - e(n) + [e(n) > 0]*(p(e(n)) ...).

Crossrefs

Programs

  • PARI
    g(n)=local(m); if(n<1, 0, m=0; until(fibonacci(m)>n, m++); m-2) \\ from A072649
    d(n) = { while(n>0, my(A=g(n), B=fibonacci(A)); n-=B; if(B>n, break)); n; }
    a(n) = if(n>0, my(A=g(n), B=fibonacci(A+1), C=n-B, D=d(C), E=g(C-1)); n + if(C>0, a(D) - D - fibonacci(E) + if(E%2==A%2, fibonacci(A-2))))

Formula

a(n) = n + [e(n) > 0]*(a(h(n)) - h(n) - f(s(n)) + [s(n) mod 2 = g(n) mod 2]*f(g(n) - 2)) for n > 0 with a(0) = 0 where s(n) = g(e(n) - 1) (here we also consider that g(0) = 0), h(n) = d(e(n)), e(n) = n - f(g(n) + 1) for n > 0 with e(0) = 0, d(n) = c(b(n)), b(n) = f(g(n) + 2) - n - 1 for n > 0 with b(0) = 0, c(n) = f(g(n) + 3) - n - 1 for n > 0 with c(0) = 0, f(n) = A000045(n) and where g(n) = A072649(n).

A200714 Stolarsky representation interpreted as binary to decimal integers.

Original entry on oeis.org

0, 1, 3, 2, 7, 5, 6, 15, 4, 11, 13, 14, 31, 10, 9, 23, 12, 27, 29, 30, 63, 8, 21, 19, 22, 47, 26, 25, 55, 28, 59, 61, 62, 127, 20, 17, 43, 18, 39, 45, 46, 95, 24, 53, 51, 54, 111, 58, 57, 119, 60, 123, 125, 126, 255, 16, 41, 35, 42, 87, 37, 38, 79, 44, 91, 93
Offset: 1

Views

Author

Casey Mongoven, Nov 20 2011

Keywords

Comments

See explanation of Stolarsky representations in the C. Mongoven link.

Examples

			The Stolarsky representation of 19 is 11101. In binary this is equal to 29. So a(19) = 29.
		

Crossrefs

Programs

  • Mathematica
    stol[n_] := stol[n] = If[n == 1, {}, If[n != Round[Round[n/GoldenRatio]*GoldenRatio], Join[stol[Floor[n/GoldenRatio^2] + 1], {0}], Join[stol[Round[n/GoldenRatio]], {1}]]];
    a[n_] := FromDigits[stol[n], 2]; Array[a, 100] (* Amiram Eldar, Jul 07 2023 *)
  • PARI
    a(n) = {if (n == 1, return (0)); tau = (1 + sqrt(5))/2; mn = 0; while ((m = round(mn*tau)) < n, mn++;); if (m == n, return (2*a(mn)+1)); mn = 0; while ((m = floor(mn*(1+tau)-tau/2)) < n, mn++;); if (m == n, return (2*a(mn))); error("neither A nor B !!");} \\ (cf C. Mongoven link) Michel Marcus, May 21 2013, Sep 02 2013
    
  • PARI
    stol(n) = {my(phi=quadgen(5)); if(n==1, [], if(n != round(round(n/phi)*phi), concat(stol(floor(n/phi^2) + 1), [0]), concat(stol(round(n/phi)), [1])));}
    a(n) = fromdigits(stol(n), 2); \\ Amiram Eldar, Jul 07 2023

Formula

From Amiram Eldar, Jul 07 2023: (Start)
A000120(a(n)) = A200649(n).
A023416(a(n)) = A200650(n).
A070939(a(n)) = A200648(n).
A005811(a(n)) = A200651(n). (End)
Conjecture: a(n) = A367306(A358654(n-1)). - Mikhail Kurkov, Oct 17 2024

Extensions

More terms from Amiram Eldar, Jul 07 2023

A209859 Rewrite the binary expansion of n from the most significant end, 1 -> 1, 0+1 (one or more zeros followed by one) -> 0, drop the trailing zeros of the original n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Mar 24 2012

Keywords

Comments

This is the number k such that the k-th composition in standard order is the reversed sequence of lengths of the maximal anti-runs of the binary indices of n. Here, the binary indices of n are row n of A048793, and the k-th composition in standard order is row k of A066099. For example, the binary indices of 100 are {3,6,7}, with maximal anti-runs ((3,6),(7)), with reversed lengths (1,2), which is the 6th composition in standard order, so a(100) = 6. - Gus Wiseman, Jul 27 2025

Examples

			102 in binary is 1100110, we rewrite it from the left so that first two 1's stay same ("11"), then "001" is rewritten to "0", the last 1 to "1", and we ignore the last 0, thus getting 1101, which is binary expansion of 13, thus a(102) = 13.
		

Crossrefs

This is an "inverse" of A071162, i.e. a(A071162(n)) = n for all n. Bisection: A209639. Used to construct permutation A209862.
Removing duplicates appears to give A358654.
Sorted positions of firsts appearances appear to be A247648+1.
A245563 lists run-lengths of binary indices (ranks A246029), reverse A245562.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    stcinv[q_]:=Total[2^(Accumulate[Reverse[q]])]/2;
    Table[stcinv[Reverse[Length/@Split[bpe[n],#2!=#1+1&]]],{n,0,100}] (* Gus Wiseman, Jul 25 2025 *)
  • Python
    import re
    def a(n): return int(re.sub("0+1", "0", bin(n)[2:].rstrip("0")), 2) if n else 0
    print([a(n) for n in range(109)])  # Michael S. Branicky, Jul 25 2025
  • Scheme
    (define (A209859 n) (let loop ((n n) (s 0) (i (A053644 n))) (cond ((zero? n) s) ((> i n) (if (> (/ i 2) n) (loop n s (/ i 2)) (loop (- n (/ i 2)) (* 2 s) (/ i 4)))) (else (loop (- n i) (+ (* 2 s) 1) (/ i 2))))))
    

Formula

a(n) = a(A000265(n)).

A385887 The number k such that the k-th composition in standard order is the reversed sequence of lengths of maximal runs of binary indices of n.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Jul 17 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.

Examples

			The binary indices of 100 are {3,6,7}, with maximal runs ((3),(6,7)), with reversed lengths (2,1), which is the 5th composition in standard order, so a(100) = 5.
		

Crossrefs

Removing duplicates appears to give A232559, see also A348366, A358654, A385818.
Sorted positions of firsts appearances appear to be A247648+1.
The non-reverse version is A385889.
A245563 lists run-lengths of binary indices (ranks A246029), reverse A245562.
A384877 lists anti-run lengths of binary indices (ranks A385816), reverse A209859.

Programs

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

A367306 Move bits in blocks in binary expansion of n where blocks are defined in Comments.

Original entry on oeis.org

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

Views

Author

Mikhail Kurkov, Nov 13 2023

Keywords

Comments

Define the "blocks" of the binary expansion of n as runs of 0's followed by a 1 bit and additionally followed with a 0 bit if it lies immediately after the 1 bit. For example, the blocks in 45986 (shown in parentheses) are 1(01)1(001)11(010)(0010). To obtain binary expansion of a(n) from binary expansion of n, move the rightmost bit in each block to the position after leftmost bit in the same block and leave all other 1 bits unchanged (see the Example).

Examples

			For n = 45986, moves are in each (...) block
  n    = 45986 = binary 1(01)1(001)11(010)(0010)
  a(n) = 46481 = binary 1(01)1(010)11(001)(0001)
We have moves in last 3 blocks, while in the first block the rightmost 1 bit is already lies on the position after leftmost bit in block, so we have no change in this case.
		

Crossrefs

Programs

  • PARI
    a(n) = my(v1); v1 = binary(n); my(A = 1); while(A <= #v1, while(A <= #v1 && v1[A], A++); my(B = A); while((A + 1) <= #v1 && !v1[A + 1], A++); if(A < #v1, if((A + 2) <= #v1 && !v1[A + 2], B = A; A++); v1[A + 1] = !v1[A + 1]; v1[B + 1] = !v1[B + 1]); A += 2); fromdigits(v1, 2)

Formula

a(n) < 2^k iff n < 2^k for k >= 0.
Conjecture: a(n) = A200714(p(n) + 1) where p(n) is an inverse permutation to A358654.
Showing 1-5 of 5 results.