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

A349344 Dirichlet inverse of A109168, where A109168(n) = (n+A006519(n))/2, and A006519 is the highest power of 2 dividing n.

Original entry on oeis.org

1, -2, -2, 0, -3, 4, -4, 0, -1, 6, -6, 0, -7, 8, 4, 0, -9, 2, -10, 0, 5, 12, -12, 0, -4, 14, -2, 0, -15, -8, -16, 0, 7, 18, 6, 0, -19, 20, 8, 0, -21, -10, -22, 0, 3, 24, -24, 0, -9, 8, 10, 0, -27, 4, 8, 0, 11, 30, -30, 0, -31, 32, 4, 0, 9, -14, -34, 0, 13, -12, -36, 0, -37, 38, 8, 0, 9, -16, -40, 0, -4, 42, -42, 0
Offset: 1

Views

Author

Antti Karttunen, Nov 15 2021

Keywords

Crossrefs

Programs

  • PARI
    up_to = 20000;
    DirInverseCorrect(v) = { my(u=vector(#v)); u[1] = (1/v[1]); for(n=2, #v, u[n] = (-u[1]*sumdiv(n, d, if(dA109168(n) = ((n+bitand(n, -n))\2); \\ From A109168 by M. F. Hasler, Oct 19 2019 (Cf. A140472).
    v349344 = DirInverseCorrect(vector(up_to,n,A109168(n)));
    A349344(n) = v349344[n];

Formula

a(1) = 1; a(n) = -Sum_{d|n, d < n} A109168(n/d) * a(d).
a(n) = A349345(n) - A109168(n).

A109170 Continued fraction expansion of 2*x which equals the continued fraction of x (A109168) interleaved with positive even numbers.

Original entry on oeis.org

2, 1, 4, 2, 6, 2, 8, 4, 10, 3, 12, 4, 14, 4, 16, 8, 18, 5, 20, 6, 22, 6, 24, 8, 26, 7, 28, 8, 30, 8, 32, 16, 34, 9, 36, 10, 38, 10, 40, 12, 42, 11, 44, 12, 46, 12, 48, 16, 50, 13, 52, 14, 54, 14, 56, 16, 58, 15, 60, 16, 62, 16, 64, 32, 66, 17, 68, 18, 70, 18, 72, 20, 74, 19, 76, 20, 78
Offset: 1

Views

Author

Paul D. Hanna, Jun 21 2005

Keywords

Examples

			2*x=2.8169885584578139714969485581613959832279979115641025629325276350497259...
The continued fraction expansion of x = A109168:
[1; 2, 2, 4, 3, 4, 4, 8, 5, 6, 6, 8, 7, 8, 8, 16, ...];
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 even numbers.
		

Crossrefs

Cf. A109168 (continued fraction of x), A109169 (digits of x), A109171 (digits of 2*x).

Programs

  • PARI
    a(n)=if(n%2==1,(n+1),if(n%4==2,(n+2)/4,2*a(n/2)))

Formula

For n>=1: a(2*n-1) = 2*n, a(4*n-2) = n, a(4*n) = 2*a(2*n).

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

Original entry on oeis.org

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

Views

Author

Paul D. Hanna, Jun 21 2005

Keywords

Examples

			x=1.408494279228906985748474279080697991613998955782051281466263817524862977...
The continued fraction expansion of x = A109168:
[1; 2, 2, 4, 3, 4, 4, 8, 5, 6, 6, 8, 7, 8, 8, 16, ...];
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 even numbers.
		

Crossrefs

Cf. A109168 (continued fraction of x), A109170 (continued fraction of 2*x), A109171 (digits of 2*x).

Programs

  • PARI
    {PQ(n)=if(n%2==1,(n+1)/2,2*PQ(n/2))}
    {CFM=contfracpnqn(vector(500,n,PQ(n))); CFM[1,1]/CFM[2,1]*1.0}

A109171 Decimal expansion of 2*x, where constant x (A109169) satisfies the condition that the continued fraction expansion of 2*x (A109170) is equal to the continued fraction expansion of x (A109168) interleaved with positive even numbers.

Original entry on oeis.org

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

Views

Author

Paul D. Hanna, Jun 21 2005

Keywords

Examples

			2*x=2.8169885584578139714969485581613959832279979115641025629325276350497259...
The continued fraction expansion of x = A109168:
[1; 2, 2, 4, 3, 4, 4, 8, 5, 6, 6, 8, 7, 8, 8, 16, ...];
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 even numbers.
		

Crossrefs

Cf. A109168 (continued fraction of x), A109169 (digits of x), A109170 (continued fraction of 2*x).

Programs

  • PARI
    {PQ(n)=if(n%2==1,(n+1)/2,2*PQ(n/2))}
    {CFM=contfracpnqn(vector(500,n,PQ(n))); x2=CFM[1,1]/CFM[2,1]*2.0}

A349345 Sum of A109168 and its Dirichlet inverse, where A109168(n) = (n+A006519(n))/2, and A006519 is the highest power of 2 dividing n.

Original entry on oeis.org

2, 0, 0, 4, 0, 8, 0, 8, 4, 12, 0, 8, 0, 16, 12, 16, 0, 12, 0, 12, 16, 24, 0, 16, 9, 28, 12, 16, 0, 8, 0, 32, 24, 36, 24, 20, 0, 40, 28, 24, 0, 12, 0, 24, 26, 48, 0, 32, 16, 34, 36, 28, 0, 32, 36, 32, 40, 60, 0, 32, 0, 64, 36, 64, 42, 20, 0, 36, 48, 24, 0, 40, 0, 76, 46, 40, 48, 24, 0, 48, 37, 84, 0, 44, 54, 88, 60, 48
Offset: 1

Views

Author

Antti Karttunen, Nov 15 2021

Keywords

Crossrefs

Programs

  • PARI
    up_to = 20000;
    DirInverseCorrect(v) = { my(u=vector(#v)); u[1] = (1/v[1]); for(n=2, #v, u[n] = (-u[1]*sumdiv(n, d, if(dA109168(n) = ((n+bitand(n, -n))\2); \\ From A109168
    v349344 = DirInverseCorrect(vector(up_to,n,A109168(n)));
    A349344(n) = v349344[n];
    A349345(n) = (A109168(n)+A349344(n));

Formula

a(n) = A109168(n) + A349344(n).
a(1) = 2, and for n > 1, a(n) = -Sum_{d|n, 1A109168(d) * A349344(n/d).
For all n >= 1, a(4*n) = 4*A109168(n). - Antti Karttunen, Dec 07 2021

A220466 a((2*n-1)*2^p) = 4^p*(n-1) + 2^(p-1)*(1+2^p), p >= 0 and n >= 1.

Original entry on oeis.org

1, 3, 2, 10, 3, 7, 4, 36, 5, 11, 6, 26, 7, 15, 8, 136, 9, 19, 10, 42, 11, 23, 12, 100, 13, 27, 14, 58, 15, 31, 16, 528, 17, 35, 18, 74, 19, 39, 20, 164, 21, 43, 22, 90, 23, 47, 24, 392, 25, 51, 26, 106, 27, 55, 28, 228, 29, 59, 30, 122, 31, 63, 32, 2080, 33, 67, 34, 138, 35
Offset: 1

Views

Author

Johannes W. Meijer, Dec 24 2012

Keywords

Comments

The a(n) appeared in the analysis of A220002, a sequence related to the Catalan numbers.
The first Maple program makes use of a program by Peter Luschny for the calculation of the a(n) values. The second Maple program shows that this sequence has a beautiful internal structure, see the first formula, while the third Maple program makes optimal use of this internal structure for the fast calculation of a(n) values for large n.
The cross references lead to sequences that have the same internal structure as this sequence.

Crossrefs

Cf. A000027 (the natural numbers), A000120 (1's-counting sequence), A000265 (remove 2's from n), A001316 (Gould's sequence), A001511 (the ruler function), A003484 (Hurwitz-Radon numbers), A003602 (a fractal sequence), A006519 (highest power of 2 dividing n), A007814 (binary carry sequence), A010060 (Thue-Morse sequence), A014577 (dragon curve), A014707 (dragon curve), A025480 (nim-values), A026741, A035263 (first Feigenbaum symbolic sequence), A037227, A038712, A048460, A048896, A051176, A053381 (smooth nowhere-zero vector fields), A055975 (Gray code related), A059134, A060789, A060819, A065916, A082392, A085296, A086799, A088837, A089265, A090739, A091512, A091519, A096268, A100892, A103391, A105321 (a fractal sequence), A109168 (a continued fraction), A117973, A129760, A151930, A153733, A160467, A162728, A181988, A182241, A191488 (a companion to Gould's sequence), A193365, A220466 (this sequence).

Programs

  • Haskell
    -- Following Ralf Stephan's recurrence:
    import Data.List (transpose)
    a220466 n = a006519_list !! (n-1)
    a220466_list = 1 : concat
       (transpose [zipWith (-) (map (* 4) a220466_list) a006519_list, [2..]])
    -- Reinhard Zumkeller, Aug 31 2014
  • Maple
    # First Maple program
    a := n -> 2^padic[ordp](n, 2)*(n+1)/2 : seq(a(n), n=1..69); # Peter Luschny, Dec 24 2012
    # Second Maple program
    nmax:=69: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n-1)*2^p) := 4^p*(n-1)  + 2^(p-1)*(1+2^p) od: od: seq(a(n), n=1..nmax);
    # Third Maple program
    nmax:=69: for p from 0 to ceil(simplify(log[2](nmax))) do n:=2^p: n1:=1: while n <= nmax do a(n) := 4^p*(n1-1)+2^(p-1)*(1+2^p): n:=n+2^(p+1): n1:= n1+1: od: od:  seq(a(n), n=1..nmax);
  • Mathematica
    A220466 = Module[{n, p}, p = IntegerExponent[#, 2]; n = (#/2^p + 1)/2; 4^p*(n - 1) + 2^(p - 1)*(1 + 2^p)] &; Array[A220466, 50] (* JungHwan Min, Aug 22 2016 *)
  • PARI
    a(n)=if(n%2,n\2+1,4*a(n/2)-2^valuation(n/2,2)) \\ Ralf Stephan, Dec 17 2013
    

Formula

a((2*n-1)*2^p) = 4^p*(n-1) + 2^(p-1)*(1+2^p), p >= 0 and n >= 1. Observe that a(2^p) = A007582(p).
a(n) = ((n+1)/2)*(A060818(n)/A060818(n-1))
a(n) = (-1/64)*(q(n+1)/q(n))/(2*n+1) with q(n) = (-1)^(n+1)*2^(4*n-5)*(2*n)!*A060818(n-1) or q(n) = (1/8)*A220002(n-1)*1/(A098597(2*n-1)/A046161(2*n))*1/(A008991(n-1)/A008992(n-1))
Recurrence: a(2n) = 4a(n) - 2^A007814(n), a(2n+1) = n+1. - Ralf Stephan, Dec 17 2013

A129760 Bitwise AND of binary representation of n-1 and n.

Original entry on oeis.org

0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 62, 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74
Offset: 1

Views

Author

Russ Cox, May 15 2007

Keywords

Comments

Also the number of Ducci sequences with period n.
Also largest number less than n having in binary representation fewer ones than n has; A048881(n-1) = A000120(a(n)) = A000120(n)-1. - Reinhard Zumkeller, Jun 30 2010
a(n) is the parent of vertex n in the binomial tree. The binomial tree is root vertex n=0, then for n>=1 the parent of n is n with its least significant 1-bit changed to a 0-bit. Binomial tree order 5, n=0 to 31 inclusive, is the frontispiece of Knuth volume 1, second and subsequent editions. Vertices are shown there with n in binary dots and a(n) is the next vertex towards the root at the bottom of the page. - Kevin Ryde, Jul 24 2019

Examples

			a(6) = 6 AND 5 = binary 110 AND 101 = binary 100 = 4.
		

References

  • Donald E. Knuth, The Art of Computer Programming, volume 1, second edition, frontispiece. Reproduced with brief description of the art in Donald E. Knuth, Selected Papers on Fun and Games, 2010, Chapter 47 Geek Art, figure 16, page 679.

Crossrefs

Programs

  • C
    int a(int n) { return n & (n-1); }
    
  • Magma
    [n - 2^Valuation(n, 2): n in [1..100]]; // Vincenzo Librandi, Jul 25 2019
    
  • Maple
    nmax := 75: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n-1)*2^p) := (2*n-2) * 2^p od: od: seq(a(n), n=1..nmax); # Johannes W. Meijer, Jun 22 2011, revised Jan 25 2013
    A129760 := n -> Bits:-And(n-1, n):
    seq(A129760(n), n=1..75); # Peter Luschny, Sep 26 2019
  • Mathematica
    Table[BitAnd[n, n - 1], {n, 1, 100}] (* Vladimir Joseph Stephan Orlovsky, Jul 19 2011 *)
  • PARI
    a(n)=bitand(n,n-1) \\ Charles R Greathouse IV, Jun 23 2011
    
  • Python
    def a(n): return n & (n-1)
    print([a(n) for n in range(1, 71)]) # Michael S. Branicky, Jul 13 2022

Formula

a(n) = n AND n-1.
Equals n - A006519(n). - N. J. A. Sloane, May 26 2008
From Johannes W. Meijer, Jun 22 2011: (Start)
a((2*n-1)*2^p) = (2*n-2)*(2^p), p>=0.
a(2*n-1) = (2*n-2), n>=1, and a(2^p+1) = 2^p, p>=1. (End)

A328203 Expansion of Sum_{k>=1} k * x^k / (1 - x^(2*k))^2.

Original entry on oeis.org

1, 2, 5, 4, 8, 10, 11, 8, 20, 16, 17, 20, 20, 22, 42, 16, 26, 40, 29, 32, 58, 34, 35, 40, 53, 40, 74, 44, 44, 84, 47, 32, 90, 52, 94, 80, 56, 58, 106, 64, 62, 116, 65, 68, 174, 70, 71, 80, 102, 106, 138, 80, 80, 148, 146, 88, 154, 88, 89, 168, 92, 94, 241, 64, 172
Offset: 1

Views

Author

Ilya Gutkovskiy, Oct 07 2019

Keywords

Crossrefs

Programs

  • Magma
    a:=[]; for k in [1..65] do if IsOdd(k) then a[k]:=(k * #Divisors(k) + DivisorSigma(1,k)) / 2; else a[k]:=(k * (#Divisors(k) - #Divisors(k div 2)) + DivisorSigma(1,k) - DivisorSigma(1,k div 2)) / 2;  end if; end for; a; // Marius A. Burtea, Oct 07 2019
    
  • Mathematica
    nmax = 65; CoefficientList[Series[Sum[k x^k/(1 - x^(2 k))^2, {k, 1, nmax}], {x, 0, nmax}], x] // Rest
    a[n_] := DivisorSum[n, (n Mod[#, 2] + Boole[OddQ[n/#]] #)/2 &]; Table[a[n], {n, 1, 65}]
  • PARI
    A328203(n) = if(n%2,(1/2)*(sigma(n)+(n*numdiv(n))),2*A328203(n/2)); \\ Antti Karttunen, Nov 13 2021

Formula

a(n) = (n * d(n) + sigma(n)) / 2 if n odd, (n * (d(n) - d(n/2)) + sigma(n) - sigma(n/2)) / 2 if n even.
a(n) = (n * A001227(n) + A002131(n)) / 2.
a(2*n) = 2 * a(n).
From Antti Karttunen, Nov 13 2021: (Start)
The following two convolutions were found by Jon Maiga's Sequence Machine search algorithm. Both are easy to prove:
a(n) = Sum_{d|n} A003602(d) * A026741(n/d).
a(n) = Sum_{d|n} A109168(d) * A193356(n/d), where A109168(d) = A140472(d) = (d+A006519(d))/2.
(End)

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

A285326 a(0) = 0, for n > 0, a(n) = n + A006519(n).

Original entry on oeis.org

0, 2, 4, 4, 8, 6, 8, 8, 16, 10, 12, 12, 16, 14, 16, 16, 32, 18, 20, 20, 24, 22, 24, 24, 32, 26, 28, 28, 32, 30, 32, 32, 64, 34, 36, 36, 40, 38, 40, 40, 48, 42, 44, 44, 48, 46, 48, 48, 64, 50, 52, 52, 56, 54, 56, 56, 64, 58, 60, 60, 64, 62, 64, 64, 128, 66, 68, 68, 72, 70, 72, 72, 80, 74, 76, 76, 80, 78, 80, 80, 96, 82, 84, 84, 88, 86, 88, 88, 96, 90, 92, 92
Offset: 0

Views

Author

Antti Karttunen, Apr 19 2017

Keywords

Comments

From M. F. Hasler, Oct 19 2019: (Start)
This sequence is equal to itself multiplied by 2 and interleaved with the positive even numbers: We have a(2n-1) = 2n (n >= 1) from the very definition, since A006519(m) = 1 for odd m. And a(2n) = 2n + A006519(2n) = 2*a(n), using A006519(2n) = 2*A006519(n).
The sequence repeats the pattern [A, B, C, C] where in the n-th occurrence C = 4n, B = C - 2, A = C if n is even, A = C + 4 if n = 3 (mod 4), and A = 16*a((n-1)/4) otherwise. (End)

Crossrefs

Row 2 of A285325 (after the initial zero).
Cf. A109168 (same terms divided by 2), also A140472.

Programs

Formula

a(0) = 0; for n > 0, a(n) = n + A006519(n).
For n >= 1, a(n) = 2*A109168(n).
a(n) = 2*A140472(n) and a(2n) = 2*a(n) and a(2^n) = 2^(n+1) for all n >= 0, a(2n-1) = 2n for all n >= 1. - M. F. Hasler, Oct 19 2019
Showing 1-10 of 10 results.