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.

A109168 Continued fraction expansion of the constant x (A109169) such that the continued fraction of 2*x yields the continued fraction of x interleaved with the positive even numbers.

Original entry on oeis.org

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

Views

Author

Paul D. Hanna, Jun 21 2005

Keywords

Comments

Compare with continued fraction A100338.
The sequence is equal to the sequence of positive integers (1, 2, 3, 4, ...) interleaved with the sequence multiplied by two, 2*(1, 2, 2, 4, 3, ...) = (2, 4, 4, 8, 6, ...): see the first formula. - M. F. Hasler, Oct 19 2019

Examples

			x=1.408494279228906985748474279080697991613998955782051281466263817524862977...
The continued fraction expansion of 2*x = A109170:
[2;1, 4,2, 6,2, 8,4, 10,3, 12,4, 14,4, 16,8, 18,5, ...]
which equals the continued fraction of x interleaved with the even numbers.
		

Crossrefs

Cf. A109169 (digits of x), A109170 (continued fraction of 2*x), A109171 (digits of 2*x).
Cf. A006519 and A129760. [Johannes W. Meijer, Jun 22 2011]
Half the terms of A285326.

Programs

  • Maple
    nmax:=75; pmax:= ceil(log(nmax)/log(2)); for p from 0 to pmax do for n from 1 to nmax do a((2*n-1)*2^p):= n*2^p: od: od: seq(a(n), n=1..nmax); # Johannes W. Meijer, Jun 22 2011
  • PARI
    a(n)=if(n%2==1,(n+1)/2,2*a(n/2))
    
  • PARI
    A109168(n)=(n+bitand(n,-n))\2 \\ M. F. Hasler, Oct 19 2019
  • Scheme
    ;; With memoization-macro definec
    (definec (A109168 n) (if (zero? n) n (if (odd? n) (/ (+ 1 n) 2) (* 2 (A109168 (/ n 2))))))
    ;; Antti Karttunen, Apr 19 2017
    

Formula

a(2*n-1) = n, a(2*n) = 2*a(n) for all n >= 1.
a((2*n-1)*2^p) = n * 2^p, p >= 0. - Johannes W. Meijer, Jun 22 2011
a(n) = n - (n AND n-1)/2. - Gary Detlefs, Jul 10 2014
a(n) = A285326(n)/2. - Antti Karttunen, Apr 19 2017
a(n) = A140472(n). - M. F. Hasler, Oct 19 2019

A140472 a(n) = a(n - a(n-1)) + a(floor(n/2)).

Original entry on oeis.org

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

Views

Author

Roger L. Bagula and Gary W. Adamson, Jun 28 2008

Keywords

Comments

From M. F. Hasler, Oct 20 2019: (Start)
The sequence A285326/2 is characterized by a(2n) = 2*a(n) (n >= 0) and a(2n-1) = n (n >= 1). This implies the property defining this sequence: If n = 2k, then n - a(n-1) = 2k - a(2k-1) = 2k - k = k, so a(n - a(n-1)) + a(floor(n/2)) = a(k) + a(k) = 2*a(k) = a(2k) = a(n). If n = 2k-1, then n - a(n-1) = 2k-1 - a(2k-2) = 2k-1 - 2*a(k-1), whence a(n - a(n-1)) + a(floor(n/2)) = a(2(k - a(k-1)) - 1) + a(k-1) = k - a(k-1) + a(k-1) = k = a(2k-1) = a(n). Thus, A285326/2 satisfies the definition of this sequence.
The sequence is equal to itself multiplied by 2 and interleaved with the positive integers. (This is equivalent to the above characterization.)
The sequence repeats the pattern [A, B, C, C] where in the n-th occurrence C = 2n, B = C - 1, A = C if n is even, A = C + 2 if n == 3 (mod 4), and A = 16*a((n-1)/4) otherwise. This yields a simpler formula for all terms except for indices which are multiples of 16. (End)

Crossrefs

Cf. A214546 (first differences).
Same as A109168, if a(0) = 0 is omitted. - M. F. Hasler, Oct 19 2019

Programs

  • Haskell
    a140472 n = a140472_list !! n
    a140472_list = 0 : 1 : h 2 1 where
      h x y = z : h (x + 1) z where z = a140472 (x - y) + a140472 (x `div` 2)
    -- Reinhard Zumkeller, Jul 20 2012
    
  • Magma
    I:=[1,2]; [0] cat [n le 2 select I[n] else Self(n-Self(n-1))+Self(Floor((n) div 2)):n in [1..75]]; // Marius A. Burtea, Aug 16 2019
    
  • Mathematica
    a[0] = 0; a[1] = 1;
    a[n_] := a[n] = a[n - a[n - 1]] + a[Floor[n/2]];
    Table[a[n], {n, 0, 200}]
  • PARI
    a(n)=(n+bitand(n,-n))\2 \\ M. F. Hasler, Oct 19 2019

Formula

a(0) = 0; a(1) = a(2) = 1; a(n) = a(n - a(n-1)) + a(floor(n/2)).
a(n) = (n+A006519(n))/2 for n > 0 (conjectured). - Jon Maiga, Aug 16 2019
a(n) = A285326(n)/2, equivalent to the above: see comments for the proof. - M. F. Hasler, Oct 19 2019

Extensions

Offset corrected by Reinhard Zumkeller, Jul 20 2012

A285325 Square array A(n,k) = A048675(A285321(n,k)), read by descending antidiagonals: A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ...

Original entry on oeis.org

1, 2, 2, 3, 4, 3, 4, 4, 6, 4, 5, 8, 5, 8, 5, 6, 6, 12, 5, 10, 6, 7, 8, 7, 16, 6, 12, 7, 8, 8, 10, 9, 20, 6, 14, 8, 9, 16, 9, 10, 8, 24, 7, 16, 9, 10, 10, 24, 9, 12, 10, 28, 7, 18, 10, 11, 12, 11, 32, 11, 14, 9, 32, 7, 20, 11, 12, 12, 18, 17, 40, 10, 12, 11, 36, 8, 22, 12, 13, 16, 13, 14, 12, 48, 10, 14, 13, 40, 8, 24, 13
Offset: 1

Views

Author

Antti Karttunen, Apr 17 2017

Keywords

Examples

			The top left 15x6 corner of the array:
  1,  2, 3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15
  2,  4, 4,  8,  6,  8,  8, 16, 10, 12, 12, 16, 14, 16, 16
  3,  6, 5, 12,  7, 10,  9, 24, 11, 18, 13, 20, 15, 18, 17
  4,  8, 5, 16,  9, 10,  9, 32, 17, 14, 13, 20, 17, 22, 17
  5, 10, 6, 20,  8, 12, 11, 40, 12, 20, 14, 24, 21, 18, 19
  6, 12, 6, 24, 10, 14, 10, 48, 18, 16, 19, 28, 16, 20, 18
		

Crossrefs

Row 1 & column 1: A000027.
Row 2: A285326, Row 3: A285327.

Programs

Formula

A(n,k) = A048675(A285321(n,k)).

A349102 Increase the odd part of n to the next greater odd number.

Original entry on oeis.org

3, 6, 5, 12, 7, 10, 9, 24, 11, 14, 13, 20, 15, 18, 17, 48, 19, 22, 21, 28, 23, 26, 25, 40, 27, 30, 29, 36, 31, 34, 33, 96, 35, 38, 37, 44, 39, 42, 41, 56, 43, 46, 45, 52, 47, 50, 49, 80, 51, 54, 53, 60, 55, 58, 57, 72, 59, 62, 61, 68, 63, 66, 65, 192, 67, 70, 69
Offset: 1

Views

Author

Kevin Ryde, Mar 26 2022

Keywords

Comments

This is +2 at the bit position of the odd part of n, that being the least significant 1-bit.
The least significant run of 1-bits changes from 0111..111 in n to 1000..001 in a(n).
Arrays A054582 and A135764 arrange terms into rows having the same number of trailing 0 bits. a(n) is the term to the right of n, i.e., next in its row.

Examples

			n    = 3448 = binary 1101 0111 1 000
a(n) = 3464 = binary 1101 1000 1 000
		

Crossrefs

Cf. A000265 (odd part), A171977 (2 at odd part), A285326.
Arrays: A054582, A135764.

Programs

  • Mathematica
    Array[# + 2^(IntegerExponent[#, 2] + 1) &, 67] (* Michael De Vlieger, Mar 27 2022 *)
  • PARI
    a(n) = n + 2<
    				

Formula

a(n) = n + A171977(n).
a(2*n) = 2*a(n).
a(2*n+1) = 2*n + 3.
Showing 1-4 of 4 results.