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.

A003602 Kimberling's paraphrases: if n = (2k-1)*2^m then a(n) = k.

Original entry on oeis.org

1, 1, 2, 1, 3, 2, 4, 1, 5, 3, 6, 2, 7, 4, 8, 1, 9, 5, 10, 3, 11, 6, 12, 2, 13, 7, 14, 4, 15, 8, 16, 1, 17, 9, 18, 5, 19, 10, 20, 3, 21, 11, 22, 6, 23, 12, 24, 2, 25, 13, 26, 7, 27, 14, 28, 4, 29, 15, 30, 8, 31, 16, 32, 1, 33, 17, 34, 9, 35, 18, 36, 5, 37, 19, 38, 10, 39, 20, 40, 3, 41, 21, 42
Offset: 1

Views

Author

Keywords

Comments

Fractal sequence obtained from powers of 2.
k occurs at (2*k-1)*A000079(m), m >= 0. - Robert G. Wilson v, May 23 2006
Sequence is T^(oo)(1) where T is acting on a word w = w(1)w(2)..w(m) as follows: T(w) = "1"w(1)"2"w(2)"3"(...)"m"w(m)"m+1". For instance T(ab) = 1a2b3. Thus T(1) = 112, T(T(1)) = 1121324, T(T(T(1))) = 112132415362748. - Benoit Cloitre, Mar 02 2009
Note that iterating the post-numbering operator U(w) = w(1) 1 w(2) 2 w(3) 3... produces the same limit sequence except with an additional "1" prepended, i.e., 1,1,1,2,1,3,2,4,... - Glen Whitney, Aug 30 2023
In the binary expansion of n, first swallow all zeros from the right, then add 1, and swallow the now-appearing 0 bit as well. - Ralf Stephan, Aug 22 2013
Although A264646 and this sequence initially agree in their digit-streams, they differ after 48 digits. - N. J. A. Sloane, Nov 20 2015
"[This is a] fractal because we get the same sequence after we delete from it the first appearance of all positive integers" - see Cobeli and Zaharescu link. - Robert G. Wilson v, Jun 03 2018
From Peter Munn, Jun 16 2022: (Start)
The sequence is the list of positive integers interleaved with the sequence itself. Provided the offset is suitable (which is the case here) a term of such a self-interleaved sequence is determined by the odd part of its index. Putting some of the formulas given here into words, a(n) is the position of the odd part of n in the list of odd numbers.
Applying the interleaving transform again, we get A110963.
(End)
Omitting all 1's leaves A131987 + 1. - David James Sycamore, Jul 26 2022
a(n) is also the smallest positive number not among the terms between a(a(n-1)) and a(n-1) inclusive (with a(0)=1 prepended). - Neal Gersh Tolunsky, Mar 07 2023

Examples

			From _Peter Munn_, Jun 14 2022: (Start)
Start of table showing the interleaving with the positive integers:
   n  a(n)  (n+1)/2  a(n/2)
   1    1      1
   2    1               1
   3    2      2
   4    1               1
   5    3      3
   6    2               2
   7    4      4
   8    1               1
   9    5      5
  10    3               3
  11    6      6
  12    2               2
(End)
		

References

  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

a(n) is the index of the column in A135764 where n appears (see also A054582).
Cf. A000079, A000265, A001511, A003603, A003961, A014577 (with offset 1, reduction mod 2), A025480, A035528, A048673, A101279, A110963, A117303, A126760, A181988, A220466, A249745, A253887, A337821 (2-adic valuation).
Cf. also A349134 (Dirichlet inverse), A349135 (sum with it), A349136 (Möbius transform), A349431, A349371 (inverse Möbius transform).
Cf. A264646.

Programs

  • Haskell
    a003602 = (`div` 2) . (+ 1) . a000265
    -- Reinhard Zumkeller, Feb 16 2012, Oct 14 2010
    
  • Haskell
    import Data.List (transpose)
    a003602 = flip div 2 . (+ 1) . a000265
    a003602_list = concat $ transpose [[1..], a003602_list]
    -- Reinhard Zumkeller, Aug 09 2013, May 23 2013
    
  • Maple
    A003602:=proc(n) options remember: if n mod 2 = 1 then RETURN((n+1)/2) else RETURN(procname(n/2)) fi: end proc:
    seq(A003602(n), n=1..83); # Pab Ter
    nmax := 83: for m from 0 to ceil(simplify(log[2](nmax))) do for k from 1 to ceil(nmax/(m+2)) do a((2*k-1)*2^m) := k od: od: seq(a(k), k=1..nmax); # Johannes W. Meijer, Feb 04 2013
    A003602 := proc(n)
        a := 1;
        for p in ifactors(n)[2] do
            if op(1,p) > 2 then
                a := a*op(1,p)^op(2,p) ;
            end if;
        end do  :
        (a+1)/2 ;
    end proc: # R. J. Mathar, May 19 2016
  • Mathematica
    a[n_] := Block[{m = n}, While[ EvenQ@m, m /= 2]; (m + 1)/2]; Array[a, 84] (* or *)
    a[1] = 1; a[n_] := a[n] = If[OddQ@n, (n + 1)/2, a[n/2]]; Array[a, 84] (* Robert G. Wilson v, May 23 2006 *)
    a[n_] := Ceiling[NestWhile[Floor[#/2] &, n, EvenQ]/2]; Array[a, 84] (* Birkas Gyorgy, Apr 05 2011 *)
    a003602 = {1}; max = 7; Do[b = {}; Do[AppendTo[b, {k, a003602[[k]]}], {k, Length[a003602]}]; a003602 = Flatten[b], {n, 2, max}]; a003602 (* L. Edson Jeffery, Nov 21 2015 *)
  • PARI
    A003602(n)=(n/2^valuation(n,2)+1)/2; /* Joerg Arndt, Apr 06 2011 */
    
  • Python
    import math
    def a(n): return (n/2**int(math.log(n - (n & n - 1), 2)) + 1)/2 # Indranil Ghosh, Apr 24 2017
    
  • Python
    def A003602(n): return (n>>(n&-n).bit_length())+1 # Chai Wah Wu, Jul 08 2022
  • Scheme
    (define (A003602 n) (let loop ((n n)) (if (even? n) (loop (/ n 2)) (/ (+ 1 n) 2)))) ;; Antti Karttunen, Feb 04 2015
    

Formula

a(n) = (A000265(n) + 1)/2.
a((2*k-1)*2^m) = k, for m >= 0 and k >= 1. - Robert G. Wilson v, May 23 2006
Inverse Weigh transform of A035528. - Christian G. Bower
G.f.: 1/x * Sum_{k>=0} x^2^k/(1-2*x^2^(k+1) + x^2^(k+2)). - Ralf Stephan, Jul 24 2003
a(2*n-1) = n and a(2*n) = a(n). - Pab Ter (pabrlos2(AT)yahoo.com), Oct 25 2005
a(A118413(n,k)) = A002024(n,k); = a(A118416(n,k)) = A002260(n,k); a(A014480(n)) = A001511(A014480(n)). - Reinhard Zumkeller, Apr 27 2006
Ordinal transform of A001511. - Franklin T. Adams-Watters, Aug 28 2006
a(n) = A249745(A126760(A003961(n))) = A249745(A253887(A048673(n))). That is, this sequence plays the same role for the numbers in array A135764 as A126760 does for the odd numbers in array A135765. - Antti Karttunen, Feb 04 2015 & Jan 19 2016
G.f. satisfies g(x) = g(x^2) + x/(1-x^2)^2. - Robert Israel, Apr 24 2015
a(n) = A181988(n)/A001511(n). - L. Edson Jeffery, Nov 21 2015
a(n) = A025480(n-1) + 1. - R. J. Mathar, May 19 2016
a(n) = A110963(2n-1) = A349135(4*n). - Antti Karttunen, Apr 18 2022
a(n) = (1 + n)/2, for n odd; a(n) = a(n/2), for n even. - David James Sycamore, Jul 28 2022
a(n) = n/2^A001511(n) + 1/2. - Alan Michael Gómez Calderón, Oct 06 2023
a(n) = A123390(A118319(n)). - Flávio V. Fernandes, Mar 02 2025

Extensions

More terms from Pab Ter (pabrlos2(AT)yahoo.com), Oct 25 2005

A131987 Representation of a dense para-sequence.

Original entry on oeis.org

1, 2, 1, 3, 4, 2, 5, 1, 6, 3, 7, 8, 4, 9, 2, 10, 5, 11, 1, 12, 6, 13, 3, 14, 7, 15, 16, 8, 17, 4, 18, 9, 19, 2, 20, 10, 21, 5, 22, 11, 23, 1, 24, 12, 25, 6, 26, 13, 27, 3, 28, 14, 29, 7, 30, 15, 31, 32, 16, 33, 8, 34, 17, 35, 4, 36, 18, 37, 9, 38, 19, 39, 2, 40, 20, 41, 10, 42, 21, 43
Offset: 1

Views

Author

Clark Kimberling, Aug 05 2007, Sep 12 2007

Keywords

Comments

A fractal sequence. The para-sequence may be regarded as a sort of "limit" of the concatenated segments. The para-sequence (itself not a sequence) is dense in the sense that every pair of terms i and j are separated by another term (and hence separated by infinitely many terms).
The para-sequence accounts for positions of dyadic rational numbers in the following way: Label 1/2 as 1; label 1/4, 3/4 as 2 and 3; label 1/8, 3/8, 5/8, 7/8 as 4,5,6,7, etc. Then, for example, the ordering 1/8 < 1/4 < 3/8 < 1/2 < 5/8 < 3/4 < 7/8 matches the labels 4,2,5,1,6,3,7, which is the 3rd segment of A131987. The n-th segment consists of labels for rationals having denominators 2, 4, 8, ..., 2^n.
Could be seen as a "fuzzy table" with row lengths 2^n-1. In row n one has the numbers, read from the leftmost to the rightmost, as they appear in a perfect binary tree of 2^n-1 nodes when inserted in "storage order" into the tree, cf. illustration in A101279 and stackexchange link. These rows are obviously permutations of [1..2^n-1], their inverse is given in A269752. - M. F. Hasler, Mar 04 2016
Subsequence of A025480 (omitting all terms=0). - David James Sycamore, Apr 26 2020
The sequence obtained by adding 1 to every term of this sequence is the same as A003602 with all 1's removed. - David James Sycamore, Jul 25 2022

Examples

			Start with 1 and isolate it using 2,3, like this: 2,1,3.  Then isolate those using 4,5,6,7, like this: 4,2,5,1,6,3,7.  The next segment, to be concatenated after 4,2,5,1,6,3,7, is 8,4,9,2,10,5,11,1,12,6,13,3,14,7,15.
		

References

  • C. Kimberling, Proper self-containing sequences, fractal sequences and para-sequences, preprint, 2007.

Crossrefs

Programs

  • Maple
    m:=p->padic[ordp](2*p,2)-1:podd:=(h,p)->2^h+(p-2)/2:peven:=(h,p)->2^(h-m(p))+(p-2^m(p))/2^(m(p)+1):for i from 0 to 5 do for j from 1 to 2^(i+1)-1 do if j mod 2 =1 then print(podd(i,j)) else print(peven(i,j)) fi od od # Gary Detlefs, Sep 28 2018
  • Mathematica
    Flatten@NestList[Riffle[Range[Length[#] + 1, 2 Length[#] + 1], #] &, {1}, 4] (* Birkas Gyorgy, Mar 11 2011 *)
  • PARI
    A131987_row(n,r=[1])={for(k=2,n,r=vector(2^k-1,j,if(bittest(j,0),j\2+2^(k-1),r[j\2])));r}
    apply(A131987_row,[1..6]) \\ or concat(...) \\ M. F. Hasler, Mar 04 2016

Formula

When viewed as a table, T(h,p), related to the in order traversal of a full binary tree, T(h,p) = 2^h+(p-1)/2, p odd, 2^(h-m(p)) + (p-2^m(p)) / 2^(m(p)+1), where m(p) is the greatest value of n such that p mod 2^n == 0. m(p) = p-adic[ordp](2*p,2)-1. - Gary Detlefs, Sep 28 2018
a((2*n+1)*2^k - k - A070941(n)) = n = A025480((2*n+1)*2^k - 1); (n>=1, k>=0). - David James Sycamore, Apr 26 2020

A360692 a(0) = 0. Thereafter a(n+1) = a(a(n)) if a(n) has not occurred previously, otherwise a(n+1) = n - 1 - a(n-1).

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 0, 3, 1, 4, 0, 5, 2, 6, 0, 7, 3, 8, 1, 9, 4, 10, 0, 11, 5, 12, 2, 13, 6, 14, 0, 15, 7, 16, 3, 17, 8, 18, 1, 19, 9, 20, 4, 21, 10, 22, 0, 23, 11, 24, 5, 25, 12, 26, 2, 27, 13, 28, 6, 29, 14, 30, 0, 31, 15, 32, 7, 33, 16, 34, 3, 35, 17, 36, 8
Offset: 0

Views

Author

David James Sycamore, Feb 16 2023

Keywords

Comments

An inductive argument shows that a(n) <= n for all n, with equality iff n = 0. It follows that a(n) is well defined, and the sequence is infinite.
Apart from a(1) = 0 every repeat term is followed by a novel term, and vice versa.
Every nonnegative integer appears infinitely many times.
The proper subsequence given by a(2*k) for k >= 2 is the sequence itself, which is therefore fractal.
Starting from a(1) = 0 the sequence is the nonnegative integers interleaved with itself.

Examples

			a(0) = 0 is a novel term so a(1) = a(a(0)) = 0. Since a(1) is a repeat term a(2) = 0 - a(0) = 0 - 0 = 0. a(1,2) = 0,0 is the only case of consecutive repeat terms.
Since a(2) = 0 is a repeat term, a(3) = 1 - a(1) = 1 - 0 = 1, a novel term so a(4) = a(a(1)) = 0, and so on.
a(16) = 3, a repeat term (last seen at a(7)), so a(17) = 15 - a(15) = 15 - 7 = 8.
		

Crossrefs

Programs

Formula

a(2*n + 1) = n for all n >= 0.
A027383(n) = 0. (n >= 0) gives the positions of all zeros after a(0) = 0.
a((2*k + 3)*2^n - 2) = k (n >= 0) gives the positions of all k > 0.
The number of nonnegative terms occurring between consecutive zeros is 0,0,1,1,3,3,7,7,15,15,... (A000225(n), repeat).
a(n) = A101279(n+2) - 1. - Rémy Sigrist, Feb 18 2023

Extensions

More terms from Rémy Sigrist, Feb 18 2023

A118816 A fractal sequence based upon powers of 3.

Original entry on oeis.org

1, 0, 1, 1, 1, 0, 2, 2, 1, 3, 3, 1, 4, 4, 1, 5, 5, 0, 6, 6, 2, 7, 7, 2, 8, 8, 1, 9, 9, 3, 10, 10, 3, 11, 11, 1, 12, 12, 4, 13, 13, 4, 14, 14, 1, 15, 15, 5, 16, 16, 5, 17, 17, 0, 18, 18, 6, 19, 19, 6, 20, 20, 2, 21, 21, 7, 22, 22, 7, 23, 23, 2, 24, 24, 8, 25, 25, 8, 26, 26, 1, 27, 27, 9, 28, 28
Offset: 1

Views

Author

Robert G. Wilson v, May 23 2006

Keywords

Comments

Zeros occur at A008776, or 2*3^(k-1), k > 0.

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := Switch[ Mod[n, 3], 0, a[n/3], 1, (n - 1)/3, 2, (n - 2)/3]; Array[a, 90]

Formula

a((3n-2)/3) = A028310(n), a((3n-1)/3) =A001477 & a(3n)=a(n), thus this sequence is a fractal.

A174989 Partial sums of A003602.

Original entry on oeis.org

1, 2, 4, 5, 8, 10, 14, 15, 20, 23, 29, 31, 38, 42, 50, 51, 60, 65, 75, 78, 89, 95, 107, 109, 122, 129, 143, 147, 162, 170, 186, 187, 204, 213, 231, 236, 255, 265, 285, 288, 309, 320, 342, 348, 371, 383, 407, 409, 434, 447, 473, 480, 507, 521, 549, 553, 582, 597
Offset: 1

Views

Author

Jonathan Vos Post, Apr 03 2010

Keywords

Comments

I conjecture that infinitely many terms are prime. For n<=10^5, exactly 5115 terms are prime. For n<=10^7, there are 352704 prime terms. The largest prime for n<10^10 is at n=9999999983, a(n)=16666666618226308891. Below 10^100, n=(10^100)-345. Below 10^500, n=(10^500)-2414. - Griffin N. Macris, May 04 2016
Since (n^2+3n)/6 < a(n) < (n^2+5n+4)/6, the sum of reciprocals of this sequence converges to a value between 13/6 and 11/3, approximately 2.888. - Griffin N. Macris, May 07 2016

Crossrefs

Programs

  • Mathematica
    a[0]:=0;
    a[n_]:=Ceiling[n/2](1+Ceiling[n/2])/2 + a[Floor[n/2]];
    Array[a,50] (* Griffin N. Macris, May 04 2016 *)

Formula

a(n) = Sum{i=1..n} A003602(i) = Sum_{i=1..n} (A000265(i) + 1)/2.
From Griffin N. Macris, May 04 2016 (Start)
a(0) = 0; a(n) = A000217(ceiling(n/2)) + a(floor(n/2)).
Asymptotically, a(n) ~ (n^2+3n)/6. (End)
a(n) = (A135013(n) + n)/2. - Amiram Eldar, Dec 27 2022
Showing 1-5 of 5 results.