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

A153733 Remove all trailing 1's in the binary representation of n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 31 2008

Keywords

Comments

a(n) is also the map n -> A065423(n+1) applied A007814(n+1) times. - Federico Provvedi, Dec 14 2021

Crossrefs

Programs

  • Haskell
    a153733 n = if b == 0 then n else a153733 n'  where (n', b) = divMod n 2
    -- Reinhard Zumkeller, Jul 22 2014
    
  • Maple
    f:= n -> (n+1)/2^padic:-ordp(n+1,2)-1:
    map(f, [$0..100]); # Robert Israel, Mar 18 2018
  • Mathematica
    Table[If[EvenQ[n],n,FromDigits[Flatten[Most[Split[IntegerDigits[n,2]]]],2]],{n,0,100}] (* Harvey P. Dale, Feb 15 2014 *)
    a[n_] := BitShiftRight[n + 1, IntegerExponent[n+1, 2]] - 1; a[Range[0,100]] (* Federico Provvedi, Dec 21 2021 *)
  • PARI
    A153733(n)=(n+=1)>>valuation(n,2)-1 \\ most efficient variant: use this. - M. F. Hasler, Mar 16 2018
    
  • PARI
    {a(n)=while(bittest(n,0),n>>=1);n} \\ for illustration: as long as there's a trailing bit 1, remove it. - M. F. Hasler, Mar 16 2018
    
  • PARI
    a(n)=for(i=0,n,bittest(n,i)||return(n>>i)) \\ scan the trailing 1's, then remove all of them at once. - M. F. Hasler, Mar 16 2018
    
  • Python
    def a(n):
        while n&1: n >>= 1
        return n
    print([a(n) for n in range(100)]) # Michael S. Branicky, Dec 18 2021
    
  • Python
    def A153733(n): return n>>(~(n+1)&n).bit_length() # Chai Wah Wu, Jul 08 2022

Formula

a(n) = n if n is even, a((n-1)/2) if odd.
a(n)/2 = A025480(n).
a(n) = A000265(n+1) - 1. - M. F. Hasler, Mar 16 2018
a(n) = n - A331739(n+1). - Federico Provvedi, Dec 21 2021

A331738 Multiplicative with a(p^e) = p^(e-A000265(e)), where A000265(x) gives the odd part of x.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 2, 1, 1, 1, 8, 1, 3, 1, 2, 1, 1, 1, 1, 5, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 8, 7, 5, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 8, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 5, 2, 1, 1, 1, 8, 27, 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, 2, 1, 1, 1, 1, 1, 7, 3, 10, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Antti Karttunen, Feb 02 2020

Keywords

Crossrefs

Programs

  • Mathematica
    f[p_, e_] := p^(e - e/2^IntegerExponent[e, 2]); a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Nov 24 2022 *)
  • PARI
    A000265(n) = (n>>valuation(n,2));
    A331738(n) = { my(f = factor(n)); prod(k=1, #f~, f[k, 1]^(f[k, 2]-A000265(f[k, 2]))); };

Formula

Multiplicative with a(p^e) = p^A331739(e).
a(n) = n / A331737(n).

A334070 Number of even-order elements in the multiplicative group of integers modulo n.

Original entry on oeis.org

0, 0, 1, 1, 3, 1, 3, 3, 3, 3, 5, 3, 9, 3, 7, 7, 15, 3, 9, 7, 9, 5, 11, 7, 15, 9, 9, 9, 21, 7, 15, 15, 15, 15, 21, 9, 27, 9, 21, 15, 35, 9, 21, 15, 21, 11, 23, 15, 21, 15, 31, 21, 39, 9, 35, 21, 27, 21, 29, 15, 45, 15, 27, 31, 45, 15, 33, 31, 33, 21, 35, 21, 63
Offset: 1

Views

Author

Robert A. Jones, Apr 13 2020

Keywords

Comments

The number of even-order elements in a finite abelian group G is |G| - b(|G|), where b is given by A000265. To see this, decompose G as a product of cyclic groups of orders {m_k}. G has [prod_k b(m_k)] elements of odd order, since an element has odd order if and only if all its components have odd order, and each C_m factor has b(m) elements of odd order. Since b can be pulled outside the product, G has b(|G|) elements of odd order. Using that the order of (Z/nZ)^x is phi(n), we obtain a(n) = phi(n) - b(phi(n)).
Since phi(n) is even when n > 2, a(n) is odd when n > 2.

Examples

			For n = 10, the elements of (Z_n)^x with even order are 3 (order 4), 7 (order 4), and 9 (order 2). Thus, a(10) = 3.
		

Crossrefs

Cf. A000010, A053575, A129527, A331739 (number of even-order elements in Z_n).

Programs

  • Maple
    a:= n-> (t-> t-t/2^padic[ordp](t, 2))(numtheory[phi](n)):
    seq(a(n), n=1..80);  # Alois P. Heinz, Apr 14 2020
  • Mathematica
    a[n_] := Length@
      Select[Range[n] - 1, EvenQ[MultiplicativeOrder[#, n]] &];
    oddPart[n_] := n/2^IntegerExponent[n,2];
    a[n_] := EulerPhi[n] - oddPart[EulerPhi[n]];

Formula

a(n) = A000010(n) - A053575(n) = A331739(A000010(n)).
Showing 1-3 of 3 results.