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.

A038572 a(n) = n rotated one binary place to the right.

Original entry on oeis.org

0, 1, 1, 3, 2, 6, 3, 7, 4, 12, 5, 13, 6, 14, 7, 15, 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31, 16, 48, 17, 49, 18, 50, 19, 51, 20, 52, 21, 53, 22, 54, 23, 55, 24, 56, 25, 57, 26, 58, 27, 59, 28, 60, 29, 61, 30, 62, 31, 63, 32, 96, 33, 97, 34, 98, 35, 99, 36, 100
Offset: 0

Views

Author

Keywords

Comments

Iterating a(n), a(a(n)), ... eventually leads to 2^A000120(n) - 1. - Franklin T. Adams-Watters, Apr 09 2010

Examples

			For n = 35, 35_10 = 100011_2, which after rotating one binary place to the right becomes 110001. Now, 110001_2 = 49_10. So, a(35) = 49. - _Indranil Ghosh_, Jan 21 2017
		

Crossrefs

Programs

  • Haskell
    a038572 0 = 0
    a038572 n = a053645 n * m + n' where (n', m) = divMod n 2
    -- Reinhard Zumkeller, Dec 03 2012
    
  • Maple
    A038572 := proc(n)
        convert(n,base,2) ;
        ListTools[Rotate](%,1) ;
        add( op(i,%)*2^(i-1),i=1..nops(%)) ;
    end proc: # R. J. Mathar, May 20 2016
  • Mathematica
    Table[ FromDigits[ RotateRight[ IntegerDigits[n, 2]], 2], {n, 0, 80}] (* Robert G. Wilson v *)
  • PARI
    a(n)=if(n<2,return(n)); my(d=binary(n)); fromdigits(concat(d[#d], d[1..#d-1]),2) \\ Charles R Greathouse IV, Sep 02 2015
    
  • Python
    def A038572(n):
        x = bin(n)[2:]
        return int(x[-1]+x[:-1],2) # Indranil Ghosh, Jan 21 2017
    
  • Python
    def A038572(n): return (n>>1)+(1<Chai Wah Wu, Jan 22 2023

Formula

a(n) = A053645(n) * A000035(n) + A004526(n) = most significant bit(n) * least significant bit(n) + floor(n/2).
a(0)=0, a(1)=1, a(2n) = n, a(2n+1) = 2a(n) + 2a(n+1) - n. - Ralf Stephan, Oct 24 2003

A088147 n-th prime rotated one binary place to the left.

Original entry on oeis.org

1, 3, 3, 7, 7, 11, 3, 7, 15, 27, 31, 11, 19, 23, 31, 43, 55, 59, 7, 15, 19, 31, 39, 51, 67, 75, 79, 87, 91, 99, 127, 7, 19, 23, 43, 47, 59, 71, 79, 91, 103, 107, 127, 131, 139, 143, 167, 191, 199, 203, 211, 223, 227, 247, 3, 15, 27, 31, 43, 51, 55, 75, 103, 111, 115, 123, 151
Offset: 1

Views

Author

Robert G. Wilson v, Sep 13 2003

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := FromDigits[ RotateLeft[ IntegerDigits[n, 2]], 2]; Table[ f[ Prime[i]], {i, 1, 60}]

A088162 n-th prime rotated one binary place to the right less the n-th prime rotated one binary place to the left.

Original entry on oeis.org

0, 0, 3, 0, 6, 3, 21, 18, 12, 3, 0, 39, 33, 30, 24, 15, 6, 3, 90, 84, 81, 72, 66, 57, 45, 39, 36, 30, 27, 21, 0, 186, 177, 174, 159, 156, 147, 138, 132, 123, 114, 111, 96, 93, 87, 84, 66, 48, 42, 39, 33, 24, 21, 6, 381, 372, 363, 360, 351, 345, 342, 327, 306, 300, 297, 291
Offset: 1

Views

Author

Robert G. Wilson v, Sep 13 2003

Keywords

Comments

Can never be negative and equals zero iff p is 2 or a Mersenne prime (A000668).

Crossrefs

Programs

  • Mathematica
    f[n_] := FromDigits[ RotateRight[ IntegerDigits[n, 2]], 2] - FromDigits[ RotateLeft[ IntegerDigits[n, 2]], 2]; Table[ f[ Prime[n]], {n, 1, 70}]
Showing 1-3 of 3 results.