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.

A101120 Records in A101119, which forms the nonzero differences of A006519 and A003484.

Original entry on oeis.org

7, 22, 52, 112, 239, 494, 1004, 2024, 4071, 8166, 16356, 32736, 65503, 131038, 262108, 524248, 1048535, 2097110, 4194260, 8388560, 16777167, 33554382, 67108812, 134217672, 268435399, 536870854, 1073741764, 2147483584, 4294967231, 8589934526, 17179869116, 34359738296
Offset: 1

Views

Author

Simon Plouffe and Paul D. Hanna, Dec 02 2004

Keywords

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{3,-2,0,1,-3,2},{7,22,52,112,239,494},30] (* Harvey P. Dale, Jan 23 2023 *)
  • PARI
    a(n)=2^(n+3)-2^((n-1)%4)-8*((n+3)\4)
    
  • Python
    def A101120(n): return (1<<(n+3))-(1<<((n-1)&3))-(((n+3)&-4)<<1) # Chai Wah Wu, Jul 10 2022

Formula

a(n) = A101119(2^(n-1)) for n>=1.
a(n) = 2^(n+3) - 2^((n-1)(mod 4)) - 8*floor((n+3)/4).
a(n) = 2^(n+3) - A003485(n+3). - Johannes W. Meijer, Oct 31 2012
From Chai Wah Wu, Apr 15 2017: (Start)
a(n) = 3*a(n-1) - 2*a(n-2) + a(n-4) - 3*a(n-5) + 2*a(n-6) for n > 6.
G.f.: x*(-x - 7)/((x - 1)^2*(x + 1)*(2*x - 1)*(x^2 + 1)). (End)
E.g.f.: (exp(x)*(32*exp(x) - 8*x - 27) - 4*cos(x) - cosh(x) - 2*sin(x) + sinh(x))/4. - Stefano Spezia, Jun 06 2023

A101122 XOR BINOMIAL transform of A101119.

Original entry on oeis.org

7, 17, 0, 34, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Simon Plouffe and Paul D. Hanna, Dec 02 2004

Keywords

Comments

Nonzero terms form A101121 and occur at positions 2^k for k >= 0. A101119 equals the nonzero differences of A006519 and A003484. See A099884 for the definition of the XOR BINOMIAL transform.

Crossrefs

Programs

  • PARI
    {a(n)=local(B);B=0;for(i=0,n-1,B=bitxor(B,binomial(n-1,i)%2* (16*2^valuation(n-i,2)-2^(valuation(n-i,2)%4)-8*(valuation(n-i,2)\4)-8)));B}
    
  • Python
    from operator import xor
    from functools import reduce
    def A101122(n): return reduce(xor,(((1<<(m:=(~(k+1)&k).bit_length()+4))-((m&-4)<<1)-(1<<(m&3)))&-int(not k&~(n-1)) for k in range(n))) # Chai Wah Wu, Jul 10 2022

Formula

a(n) = SumXOR_{k=0..n} (C(n, k) mod 2)*A101119(k), where SumXOR is summation under XOR. A101119(n) = SumXOR_{k=0..n} (C(n, k) mod 2)*a(k). a(2^(n-1)) = A101121(n) for n >= 1 and a(k)=0 when k is not a power of 2.

A006519 Highest power of 2 dividing n.

Original entry on oeis.org

1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 32, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 64, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 16, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 32, 1, 2, 1, 4, 1, 2
Offset: 1

Views

Author

Keywords

Comments

Least positive k such that m^k + 1 divides m^n + 1 (with fixed base m). - Vladimir Baltic, Mar 25 2002
To construct the sequence: start with 1, concatenate 1, 1 and double last term gives 1, 2. Concatenate those 2 terms, 1, 2, 1, 2 and double last term 1, 2, 1, 2 -> 1, 2, 1, 4. Concatenate those 4 terms: 1, 2, 1, 4, 1, 2, 1, 4 and double last term -> 1, 2, 1, 4, 1, 2, 1, 8, etc. - Benoit Cloitre, Dec 17 2002
a(n) = gcd(seq(binomial(2*n, 2*m+1)/2, m = 0 .. n - 1)) (odd numbered entries of even numbered rows of Pascal's triangle A007318 divided by 2), where gcd() denotes the greatest common divisor of a set of numbers. Due to the symmetry of the rows it suffices to consider m = 0 .. floor((n-1)/2). - Wolfdieter Lang, Jan 23 2004
Equals the continued fraction expansion of a constant x (cf. A100338) such that the continued fraction expansion of 2*x interleaves this sequence with 2's: contfrac(2*x) = [2; 1, 2, 2, 2, 1, 2, 4, 2, 1, 2, 2, 2, 1, 2, 8, 2, ...].
Simon Plouffe observes that this sequence and A003484 (Radon function) are very similar, the difference being all zeros except for every 16th term (see A101119 for nonzero differences). Dec 02 2004
This sequence arises when calculating the next odd number in a Collatz sequence: Next(x) = (3*x + 1) / A006519, or simply (3*x + 1) / BitAnd(3*x + 1, -3*x - 1). - Jim Caprioli, Feb 04 2005
a(n) = n if and only if n = 2^k. This sequence can be obtained by taking a(2^n) = 2^n in place of a(2^n) = n and using the same sequence building approach as in A001511. - Amarnath Murthy, Jul 08 2005
Also smallest m such that m + n - 1 = m XOR (n - 1); A086799(n) = a(n) + n - 1. - Reinhard Zumkeller, Feb 02 2007
Number of 1's between successive 0's in A159689. - Philippe Deléham, Apr 22 2009
Least number k such that all coefficients of k*E(n, x), the n-th Euler polynomial, are integers (cf. A144845). - Peter Luschny, Nov 13 2009
In the binary expansion of n, delete everything left of the rightmost 1 bit. - Ralf Stephan, Aug 22 2013
The equivalent sequence for partitions is A194446. - Omar E. Pol, Aug 22 2013
Also the 2-adic value of 1/n, n >= 1. See the Mahler reference, definition on p. 7. This is a non-archimedean valuation. See Mahler, p. 10. Sometimes called 2-adic absolute value of 1/n. - Wolfdieter Lang, Jun 28 2014
First 2^(k-1) - 1 terms are also the heights of the successive rectangles and squares of width 2 that are adjacent to any of the four sides of the toothpick structure of A139250 after 2^k stages, with k >= 2. For example: if k = 5 the heights after 32 stages are [1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1] respectively, the same as the first 15 terms of this sequence. - Omar E. Pol, Dec 29 2020

Examples

			2^3 divides 24, but 2^4 does not divide 24, so a(24) = 8.
2^0 divides 25, but 2^1 does not divide 25, so a(25) = 1.
2^1 divides 26, but 2^2 does not divide 26, so a(26) = 2.
Per _Marc LeBrun_'s 2000 comment, a(n) can also be determined with bitwise operations in two's complement. For example, given n = 48, we see that n in binary in an 8-bit byte is 00110000 while -n is 11010000. Then 00110000 AND 11010000 = 00010000, which is 16 in decimal, and therefore a(48) = 16.
G.f. = x + 2*x^2 + x^3 + 4*x^4 + x^5 + 2*x^6 + x^7 + 8*x^8 + x^9 + ...
		

References

  • Kurt Mahler, p-adic numbers and their functions, second ed., Cambridge University Press, 1981.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Partial sums are in A006520, second partial sums in A022560.
Sequences used in definitions of this sequence: A000079, A001511, A004198, A007814.
Sequences with related definitions: A038712, A171977, A135481 (GS(1, 6)).
This is Guy Steele's sequence GS(5, 2) (see A135416).
Related to A007913 via A225546.
A059897 is used to express relationship between sequence terms.
Cf. A091476 (Dgf at s=2).

Programs

  • Haskell
    import Data.Bits ((.&.))
    a006519 n = n .&. (-n) :: Integer
    -- Reinhard Zumkeller, Mar 11 2012, Dec 29 2011
    
  • Julia
    using IntegerSequences
    [EvenPart(n) for n in 1:102] |> println  # Peter Luschny, Sep 25 2021
    
  • Magma
    [2^Valuation(n, 2): n in [1..100]]; // Vincenzo Librandi, Mar 27 2015
    
  • Maple
    with(numtheory): for n from 1 to 200 do if n mod 2 = 1 then printf(`%d,`,1) else printf(`%d,`,2^ifactors(n)[2][1][2]) fi; od:
    A006519 := proc(n) if type(n,'odd') then 1 ; else for f in ifactors(n)[2] do if op(1,f) = 2 then return 2^op(2,f) ; end if; end do: end if; end proc: # R. J. Mathar, Oct 25 2010
    A006519 := n -> 2^padic[ordp](n,2): # Peter Luschny, Nov 26 2010
  • Mathematica
    lowestOneBit[n_] := Block[{k = 0}, While[Mod[n, 2^k] == 0, k++]; 2^(k - 1)]; Table[lowestOneBit[n], {n, 102}] (* Robert G. Wilson v Nov 17 2004 *)
    Table[2^IntegerExponent[n, 2], {n, 128}] (* Jean-François Alcover, Feb 10 2012 *)
    Table[BitAnd[BitNot[i - 1], i], {i, 1, 102}] (* Peter Luschny, Oct 10 2019 *)
  • PARI
    {a(n) = 2^valuation(n, 2)};
    
  • PARI
    a(n)=1<Joerg Arndt, Jun 10 2011
    
  • PARI
    a(n)=bitand(n,-n); \\ Joerg Arndt, Jun 10 2011
    
  • PARI
    a(n)=direuler(p=2,n,if(p==2,1/(1-2*X),1/(1-X)))[n] \\ Ralf Stephan, Mar 27 2015
    
  • Python
    def A006519(n): return n&-n # Chai Wah Wu, Jul 06 2022
  • Scala
    (1 to 128).map(Integer.lowestOneBit()) // _Alonso del Arte, Mar 04 2020
    

Formula

a(n) = n AND -n (where "AND" is bitwise, and negative numbers are represented in two's complement in a suitable bit width). - Marc LeBrun, Sep 25 2000, clarified by Alonso del Arte, Mar 16 2020
Also: a(n) = gcd(2^n, n). - Labos Elemer, Apr 22 2003
Multiplicative with a(p^e) = p^e if p = 2; 1 if p > 2. - David W. Wilson, Aug 01 2001
G.f.: Sum_{k>=0} 2^k*x^2^k/(1 - x^2^(k+1)). - Ralf Stephan, May 06 2003
Dirichlet g.f.: zeta(s)*(2^s - 1)/(2^s - 2) = zeta(s)*(1 - 2^(-s))/(1 - 2*2^(-s)). - Ralf Stephan, Jun 17 2007
a(n) = 2^floor(A002487(n - 1) / A002487(n)). - Reikku Kulon, Oct 05 2008
a(n) = 2^A007814(n). - R. J. Mathar, Oct 25 2010
a((2*k - 1)*2^e) = 2^e, k >= 1, e >= 0. - Johannes W. Meijer, Jun 07 2011
a(n) = denominator of Euler(n-1, 1). - Arkadiusz Wesolowski, Jul 12 2012
a(n) = A011782(A001511(n)). - Omar E. Pol, Sep 13 2013
a(n) = (n XOR floor(n/2)) XOR (n-1 XOR floor((n-1)/2)) = n - (n AND n-1) (where "AND" is bitwise). - Gary Detlefs, Jun 12 2014
a(n) = ((n XOR n-1)+1)/2. - Gary Detlefs, Jul 02 2014
a(n) = A171977(n)/2. - Peter Kern, Jan 04 2017
a(n) = 2^(A001511(n)-1). - Doug Bell, Jun 02 2017
a(n) = abs(A003188(n-1) - A003188(n)). - Doug Bell, Jun 02 2017
Conjecture: a(n) = (1/(A000203(2*n)/A000203(n)-2)+1)/2. - Velin Yanev, Jun 30 2017
a(n) = (n-1) o n where 'o' is the bitwise converse nonimplication. 'o' is not commutative. n o (n+1) = A135481(n). - Peter Luschny, Oct 10 2019
From Peter Munn, Dec 13 2019: (Start)
a(A225546(n)) = A225546(A007913(n)).
a(A059897(n,k)) = A059897(a(n), a(k)). (End)
Sum_{k=1..n} a(k) ~ (1/(2*log(2)))*n*log(n) + (3/4 + (gamma-1)/(2*log(2)))*n, where gamma is Euler's constant (A001620). - Amiram Eldar, Nov 15 2022
a(n) = n / A000265(n). - Amiram Eldar, May 22 2025

Extensions

More terms from James Sellers, Jun 20 2000

A003484 Radon function, also called Hurwitz-Radon numbers.

Original entry on oeis.org

1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 9, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 10, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 9, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 12, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 9, 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, 10, 1, 2, 1, 4, 1, 2
Offset: 1

Views

Author

Keywords

Comments

This sequence and A006519 (greatest power of 2 dividing n) are very similar, the difference being all zeros except for every 16th term (see A101119 for nonzero differences). - Simon Plouffe, Dec 02 2004
For all n congruent to 2^k (mod 2^(k+1)), a(n) is the same. Therefore, for any natural number m, the list of the first 2^m - 1 terms is palindromic. - Ivan N. Ianakiev, Jul 21 2019
Named after the Austrian mathematician Johann Radon (1887-1956) and the German mathematician Adolf Hurwitz (1859-1919). - Amiram Eldar, Jun 15 2021

Examples

			G.f. = x + 2*x^2 + x^3 + 4*x^4 + x^5 + 2*x^6 + x^7 + 8*x^8 + x^9 + ...
		

References

  • T. Y. Lam, The Algebraic Theory of Quadratic Forms. Benjamin, Reading, MA, 1973, p. 131.
  • Takashi Ono, Variations on a Theme of Euler, Plenum, NY, 1994, p. 192.
  • A. R. Rajwade, Squares, Camb. Univ. Press, London Math. Soc. Lecture Notes Series 171, 1993; see p. 127.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A053381 for a closely related sequence.

Programs

  • Haskell
    a003484 n = 2 * e + cycle [1,0,0,2] !! e  where e = a007814 n
    -- Reinhard Zumkeller, Mar 11 2012
    
  • Maple
    readlib(ifactors): for n from 1 to 150 do if n mod 2 = 1 then printf(`%d,`,1) fi: if n mod 2 = 0 then m := ifactors(n)[2][1][2]: if m mod 4 = 0 then printf(`%d,`,2*m+1) fi: if m mod 4 = 1 then printf(`%d,`,2*m) fi: if m mod 4 = 2 then printf(`%d,`,2*m) fi: if m mod 4 = 3 then printf(`%d,`,2*m+2) fi: fi: od: # James Sellers, Dec 07 2000
    nmax:=102; A003485 := proc(n): A003485(n) := ceil((n+1)/4) + ceil(n/4) + 2*ceil((n-1)/4) + 4*ceil((n-2)/4) end: A029837 := n -> ceil(simplify(log[2](n))): for p from 0 to A029837(nmax) do for n from 1 to ceil(nmax/(p+2)) do A003484((2*n-1)*2^p):= A003485(p): od: od: seq(A003484(n), n=1..nmax); # Johannes W. Meijer, Jun 07 2011, Dec 15 2012
  • Mathematica
    a[n_] := 8*Quotient[IntegerExponent[n, 2], 4] + 2^Mod[IntegerExponent[n, 2], 4]; Table[a[n], {n, 1, 102}] (* Jean-François Alcover, Sep 08 2011, after Paul D. Hanna *)
  • PARI
    a(n)=8*(valuation(n,2)\4)+2^(valuation(n,2)%4) /* Paul D. Hanna, Dec 02 2004 */
    
  • Python
    def A003484(n): return (((m:=(~n&n-1).bit_length())&-4)<<1)+(1<<(m&3)) # Chai Wah Wu, Jul 09 2022

Formula

a(n) = A003485(A007814(n)).
If n=2^(4*b+c)*d, 0<=c<=3, d odd, then a(n) = 8*b + 2^c.
If n=2^m*d, d odd, then a(n) = 2*m+1 if m=0 mod 4, a(n) = 2*m if m=1 or 2 mod 4, a(n) = 2*m+2 (otherwise, i.e., if m=3 mod 4).
Multiplicative with a(p^e) = 2e + a_(e mod 4) if p = 2; 1 if p > 2; where a = (1, 0, 0, 2). - David W. Wilson, Aug 01 2001
Dirichlet g.f. zeta(s) *(1-1/2^s)* {7*2^(-4*s) +1 +2^(3-3*s) +3*2^(1-5*s) +2^(1-s) +2^(2-6*s) +2^(2-2*s) }/ (1-2^(-4*s))^2. - R. J. Mathar, Mar 04 2011
a(A005408(n))=1; a(2*n) = A209675(n); a(A016825(n))=2; a(A017113(n))=4; a(A051062(n))=8. - Reinhard Zumkeller, Mar 11 2012
a((2*n-1)*2^p) = A003485(p), p >=0. - Johannes W. Meijer, Jun 07 2011, Dec 15 2012
Lambert series g.f. Sum_(k >=0) q^(2^(4*k))/(1-q^(2^(4*k))) +q^(2^(4*k+1))/(1-q^(2^(4*k+1))) +2*q^(2^(4*k+2))/(1-q^(2^(4*k+2))) +4*q^(2^(4*k+3))/(1-q^(2^(4*k+3))). - Mamuka Jibladze, Dec 07 2016
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 8/3. - Amiram Eldar, Oct 22 2022

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Mar 20 2000

A101121 Bitwise XOR of adjacent terms of A101120; also the nonzero terms of A101122.

Original entry on oeis.org

7, 17, 34, 68, 159, 257, 514, 1028, 2063, 4097, 8194, 16388, 32831, 65537, 131074, 262148, 524303, 1048577, 2097154, 4194308, 8388639, 16777217, 33554434, 67108868, 134217743, 268435457, 536870914, 1073741828, 2147483775
Offset: 1

Views

Author

Simon Plouffe and Paul D. Hanna, Dec 02 2004

Keywords

Comments

A101120 gives the records in A101119, which equals the nonzero differences of A006519 and A003484. A101122 is the XOR BINOMIAL transform of A101119 and has zeros everywhere except at positions equal to powers of 2.

Examples

			a(5) = 159 since A101120(4)=112, A101120(5)=239 and 159 = 112 XOR 239.
		

Crossrefs

Programs

  • PARI
    {a(n)=bitxor(2^(n+2)-2^((n-2)%4)-8*((n+2)\4),2^(n+3)-2^((n-1)%4)-8*((n+3)\4))}
    
  • Python
    def A101121(n): return ((1<<(n+2))-(1<<((n-2)&3))-(((n+2)&-4)<<1))^((1<<(n+3))-(1<<((n-1)&3))-(((n+3)&-4)<<1)) # Chai Wah Wu, Jul 10 2022

Formula

a(n) = A101120(n-1) XOR A101120(n) for n>1, with a(1) = A101120(1), where A101120(n) = 2^(n+3) - 2^((n-1)(Mod 4)) - 8*floor((n+3)/4).
Showing 1-5 of 5 results.