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 14 results. Next

A103581 A102371 written in base 2.

Original entry on oeis.org

1, 10, 111, 1100, 11101, 111110, 1111011, 11111000, 111111001, 1111111010, 11111111111, 111111110100, 1111111110101, 11111111110110, 111111111110011, 1111111111110000, 11111111111110001, 111111111111110010
Offset: 1

Views

Author

Philippe Deléham, Mar 23 2005

Keywords

Comments

The number of zeros in the n-th term appears to match A089398. - Benoit Cloitre, Mar 24 2005

Crossrefs

Formula

a(n) = A007088(A102371(n)). - Michel Marcus, May 08 2020

Extensions

More terms from Benoit Cloitre, Mar 24 2005

A103122 Define a 1-1 correspondence between the integers Z and the nonnegative integers N by f(n) = A102370(n) if n >= 0, f(n) = A102371(-n) if n < 0; sequence gives a(n) = f^(-1)(n) for n >= 0.

Original entry on oeis.org

0, -1, -2, 1, 4, 3, 2, -3, 8, 7, 6, 9, -4, 11, 10, 5, 16, 15, 14, 17, 20, 19, 18, 13, 24, 23, 22, 25, 12, -5, 26, 21, 32, 31, 30, 33, 36, 35, 34, 29, 40, 39, 38, 41, 28, 43, 42, 37, 48, 47, 46, 49, 52, 51, 50, 45, 56, 55, 54, 57, 44, 27, -6, 53, 64, 63, 62, 65, 68
Offset: 0

Views

Author

N. J. A. Sloane, Mar 24 2005

Keywords

Comments

A 1-1 map from the nonnegative integers to all integers.
Simply stated: a(n) = index of n in A102370 if it is a member, else minus its index in the complement A102371. - M. F. Hasler, Apr 14 2022

Programs

  • PARI
    A103122(n)=if(n<0,0,s=-n;while(abs(if(sign(s)+1,2^s-1/2-1/2*sum(k=0,s,(-1)^floor((s+k)/2^k)*2^k),2^(-s-1)-1/2+1/2*sum(k=0,-s-1,(-1)^floor((-s-1-k)/2^k)*2^k))-n)>0,s++);s) \\ Benoit Cloitre, Mar 29 2005

Extensions

More terms from Benoit Cloitre, Mar 29 2005

A103745 a(n) = (A102371(n) + n)/2.

Original entry on oeis.org

1, 2, 5, 8, 17, 34, 65, 128, 257, 514, 1029, 2048, 4097, 8194, 16385, 32768, 65537, 131074, 262149, 524296, 1048577, 2097154, 4194305, 8388608, 16777217, 33554434, 67108869, 134217728, 268435457, 536870914, 1073741825, 2147483648, 4294967297, 8589934594, 17179869189
Offset: 1

Views

Author

Philippe Deléham, Mar 26 2005

Keywords

Comments

Values of A103185 (first zero omitted) which are >= a new power of 2 . The initial values of A103185 are 0*, 1*, 2*, 1, 0, 5*, 2, 1, 0, 1, 2, 1, 8*, 5, 2, 1, ... and the starred terms are those which exceed the next power of 2 . Their indices (except for the zero term) are given by A000325.

Crossrefs

Programs

  • PARI
    a(n) = 2^(n-1) + sum(k = 1, n-1, if ((n % 2^k) == k, 2^(k-1))); \\ Michel Marcus, May 06 2020

Formula

a(n) = Sum_{ k>= 1, k == n (mod 2^k) } 2^(k-1). - N. J. A. Sloane and David Applegate, Mar 22 2005
a(n) = A103528(n) + 2^(n-1).

Extensions

a(27) corrected and more terms from Michel Marcus, May 06 2020

A104403 a(0)=0; for n>0, a(n) = A102371(4n)/4.

Original entry on oeis.org

0, 3, 62, 1021, 16380, 262143, 4194298, 67108857, 1073741816, 17179869179, 274877906934, 4398046511093, 70368744177652, 1125899906842615, 18014398509481970, 288230376151711729, 4611686018427387888, 73786976294838206451, 1180591620717411303406, 18889465931478580854765
Offset: 0

Views

Author

N. J. A. Sloane, Apr 18 2005

Keywords

Crossrefs

Formula

a(0) = 0; for n>0, a(n) = 2^(4n-2) - A109680(n). - Philippe Deléham, May 08 2005

A105024 a(n) = A102371(n) + n. Or, 2*A103745.

Original entry on oeis.org

0, 2, 4, 10, 16, 34, 68, 130, 256, 514, 1028, 2058, 4096, 8194, 16388, 32770, 65536, 131074, 262148, 524298, 1048592, 2097154, 4194308, 8388610, 16777216, 33554434, 67108868, 134217738, 268435456, 536870914, 1073741828, 2147483650, 4294967296, 8589934594
Offset: 0

Views

Author

N. J. A. Sloane, Apr 03 2005

Keywords

Programs

  • Maple
    sm:= proc (n) local t1, l; t1 := 0; for l to n do if `mod`(n-l,2^l) = 0 then t1 := t1+2^l end if end do; t1 end proc;

A105158 Table T(n,k), read by downward antidiagonals, defined by : T(0,0) = 0, T(n,n) = 2^n for n>0, T(n,k) - T(n,n) = A102371(n - k) if 0<= k < n, T(n,k) - T(n,n) = A102370(k - n) if k >= n.

Original entry on oeis.org

0, 3, 3, 6, 2, 6, 5, 5, 5, 15, 4, 8, 4, 28, 15, 7, 7, 9, 23, 61, 10, 6, 10, 8, 18, 44, 126, 9, 17, 9, 11, 17, 39, 93, 251, 8, 12, 8, 14, 16, 34, 76, 190, 504, 11, 11, 19, 13, 19, 33, 71, 157, 379, 1017, 14, 10, 14, 12, 22, 32, 66, 140, 318, 760, 2042, 13, 13, 13, 23, 21, 35, 65
Offset: 0

Views

Author

Philippe Deléham, May 01 2005

Keywords

Comments

Consider T(0,0) and the 2^n -1 first terms of the row n for n>0; this give A102370 : 0; 3; 6, 5, 4; 15, 10, 9, 8, 11, 14, 13; 28, 23, 18, 17, 16, 19, 22, 21, 20, 31, 26, 25, 24, 27, 30; ...

Examples

			Table T(n,k) begins:
0, 3, 6, 5, 4, 15, 10, 9, 8, 11, 14, 13, 28, ...
3, 2, 5, 8, 7, 6, 17, 12, 11, 10, 13, 16, 15, ...
6, 5, 4, 7, 10, 9, 8, 19, 14, 13, 12, 15, 18, ...
15, 10, 9, 8, 11, 14, 13, 12, 23, 18, 17, 16, 19, ...
28, 23, 18, 17, 16, 19, 22, 21, 20, 31, 26, 25, 24, ...
		

Crossrefs

Formula

T(0, k) = A102370(k); T(n, 0) = A103529(n+1).

A102370 "Sloping binary numbers": write numbers in binary under each other (right-justified), read diagonals in upward direction, convert to decimal.

Original entry on oeis.org

0, 3, 6, 5, 4, 15, 10, 9, 8, 11, 14, 13, 28, 23, 18, 17, 16, 19, 22, 21, 20, 31, 26, 25, 24, 27, 30, 61, 44, 39, 34, 33, 32, 35, 38, 37, 36, 47, 42, 41, 40, 43, 46, 45, 60, 55, 50, 49, 48, 51, 54, 53, 52, 63, 58, 57, 56, 59, 126, 93, 76, 71, 66, 65, 64, 67, 70, 69
Offset: 0

Views

Author

Philippe Deléham, Feb 13 2005

Keywords

Comments

All terms are distinct, but certain terms (see A102371) are missing. But see A103122.
Trajectory of 1 is 1, 3, 5, 15, 17, 19, 21, 31, 33, ..., see A103192.

Examples

			........0
........1
.......10
.......11
......100
......101
......110
......111
.....1000
.........
The upward-sloping diagonals are:
0
11
110
101
100
1111
1010
.......
giving 0, 3, 6, 5, 4, 15, 10, ...
The sequence has a natural decomposition into blocks (see the paper): 0; 3; 6, 5, 4; 15, 10, 9, 8, 11, 14, 13; 28, 23, 18, 17, 16, 19, 22, 21, 20, 31, 26, 25, 24, 27, 30; 61, ...
Reading the array of binary numbers along diagonals with slope 1 gives this sequence, slope 2 gives A105085, slope 0 gives A001477 and slope -1 gives A105033.
		

Crossrefs

Related sequences (1): A103542 (binary version), A102371 (complement), A103185, A103528, A103529, A103530, A103318, A034797, A103543, A103581, A103582, A103583.
Related sequences (2): A103584, A103585, A103586, A103587, A103127, A103192 (trajectory of 1), A103122, A103588, A103589, A103202 (sorted), A103205 (base 10 version).
Related sequences (3): A103747 (trajectory of 2), A103621, A103745, A103615, A103842, A103863, A104234, A104235, A103813, A105023, A105024, A105025, A105026, A105027, A105028.
Related sequences (4): A105029, A105030, A105031, A105032, A105033, A105034, A105035, A105108.

Programs

  • Haskell
    a102370 n = a102370_list !! n
    a102370_list = 0 : map (a105027 . toInteger) a062289_list
    -- Reinhard Zumkeller, Jul 21 2012
    
  • Maple
    A102370:=proc(n) local t1,l; t1:=n; for l from 1 to n do if n+l mod 2^l = 0 then t1:=t1+2^l; fi; od: t1; end;
  • Mathematica
    f[n_] := Block[{k = 1, s = 0, l = Max[2, Floor[Log[2, n + 1] + 2]]}, While[k < l, If[ Mod[n + k, 2^k] == 0, s = s + 2^k]; k++ ]; s]; Table[ f[n] + n, {n, 0, 71}] (* Robert G. Wilson v, Mar 21 2005 *)
  • PARI
    A102370(n)=n-1+sum(k=0,ceil(log(n+1)/log(2)),if((n+k)%2^k,0,2^k)) \\ Benoit Cloitre, Mar 20 2005
    
  • PARI
    {a(n) = if( n<1, 0, sum( k=0, length( binary( n)), bitand( n + k, 2^k)))} /* Michael Somos, Mar 26 2012 */
    
  • Python
    def a(n): return 0 if n<1 else sum([(n + k)&(2**k) for k in range(len(bin(n)[2:]) + 1)]) # Indranil Ghosh, May 03 2017

Formula

a(n) = n + Sum_{ k >= 1 such that n + k == 0 mod 2^k } 2^k. (Cf. A103185.) In particular, a(n) >= n. - N. J. A. Sloane, Mar 18 2005
a(n) = A105027(A062289(n)) for n > 0. - Reinhard Zumkeller, Jul 21 2012

Extensions

More terms from Benoit Cloitre, Mar 20 2005

A105027 Write numbers in binary under each other; to get the next block of 2^k (k >= 0) terms of the sequence, start at 2^k, read diagonals in upward direction and convert to decimal.

Original entry on oeis.org

0, 1, 3, 2, 6, 5, 4, 7, 15, 10, 9, 8, 11, 14, 13, 12, 28, 23, 18, 17, 16, 19, 22, 21, 20, 31, 26, 25, 24, 27, 30, 29, 61, 44, 39, 34, 33, 32, 35, 38, 37, 36, 47, 42, 41, 40, 43, 46, 45, 60, 55, 50, 49, 48, 51, 54, 53, 52, 63, 58, 57, 56, 59, 62, 126, 93, 76, 71, 66, 65, 64, 67, 70
Offset: 0

Views

Author

N. J. A. Sloane, Apr 03 2005

Keywords

Comments

This is a permutation of the nonnegative integers.
Structure: blocks of size 2^k - 1 taken from A102370, interspersed with terms of A102371. - Philippe Deléham, Nov 17 2007
a(A062289(n)) = A102370(n) for n > 0; a(A000225(n)) = A102371(n); a(A214433(n)) = A105025(a(n)). - Reinhard Zumkeller, Jul 21 2012

Examples

			        0
        1
       10
       11
   -> 100  Starting here, the upward diagonals
      101  read 110, 101, 100, 111, giving the block 6, 5, 4, 7.
      110
      111
     1000
     1001
     1010
     1011
      ...
		

Crossrefs

Cf. A214414 (fixed points), A214417 (inverse).

Programs

  • Haskell
    import Data.Bits ((.|.), (.&.))
    a105027 n = foldl (.|.) 0 $ zipWith (.&.)
                      a000079_list $ enumFromTo (n + 1 - a070939 n) n
    -- Reinhard Zumkeller, Jul 21 2012
    
  • Mathematica
    block[k_] := Module[{t}, t = Table[PadLeft[IntegerDigits[n, 2], k+1], {n, 2^(k-1), 2^(k+1)-1}]; Table[FromDigits[Table[t[[n-m+1, m]], {m, 1, k+1}], 2], {n,2^(k-1)+1, 2^(k-1)+2^k}]]; block[0] = {0, 1}; Table[block[k], {k, 0, 6}] // Flatten (* Jean-François Alcover, Jun 30 2015 *)
  • PARI
    apply( {A105027(n,L=exponent(n+!n))=sum(k=0,L,bitand(n+k-L,2^k))}, [0..55]) \\ M. F. Hasler, Apr 18 2022

Formula

a(2^n - 1) = A102371(n) for n > 0. - Philippe Deléham, May 10 2005

Extensions

More terms from John W. Layman, Apr 07 2005

A103530 a(n) = 2^n - A103529(n).

Original entry on oeis.org

2, 1, 2, 1, 4, 3, 2, 5, 8, 7, 6, 1, 12, 11, 10, 13, 16, 15, 14, 9, 4, 19, 18, 21, 24, 23, 22, 17, 28, 27, 26, 29, 32, 31, 30, 25, 20, 3, 34, 37, 40, 39, 38, 33, 44, 43, 42, 45, 48, 47, 46, 41, 36, 51, 50, 53, 56, 55, 54, 49, 60, 59, 58, 61, 64, 63, 62, 57
Offset: 1

Views

Author

Keywords

Examples

			a(7) = 2^7 - A103529(7) = 128 - 126 = 2.
		

Programs

  • Maple
    a:=proc(n)local k,t: if(n=1)then return 2:fi: t:= 2^(n-1) + (n-1): for k from 1 to n-1 do if(k = (n-1) mod 2^k)then t:=t-2^k: fi: od: return t: end: seq(a(n),n=1..80); # Nathaniel Johnston, Apr 30 2011

Formula

Also, miraculously, a(n+1) = 2^n - A102371(n) for n >= 1.

A103528 a(n) = Sum_{k = 1..n-1 such that n == k (mod 2^k)} 2^(k-1).

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 1, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 17, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 1, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 17, 34, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8, 1, 2, 1, 0, 1, 2, 5, 0, 1, 2, 1, 0, 1, 2, 5, 8
Offset: 1

Views

Author

N. J. A. Sloane, Mar 22 2005

Keywords

Comments

Is there a simpler closed form?

Crossrefs

Cf. A102371.

Programs

  • Maple
    f:=proc(n) local t1,k; t1:=0; for k from 1 to n-1 do if n mod 2^k = k then t1:=t1+2^(k-1); fi; od: t1; end;
  • Mathematica
    (* b = A102371 (using Alex Ratushnyak's code) *)
    b[n_] := b[n] = If[n == 1, 1, BitXor[b[n-1], b[n-1] + n]];
    a[n_] := (b[n] + n)/2 - 2^(n-1);
    Array[a, 100] (* Jean-François Alcover, Apr 11 2019, after Philippe Deléham *)
  • PARI
    a(n) = sum(k = 1, n-1, if ((n % 2^k) == k, 2^(k-1))); \\ Michel Marcus, May 06 2020

Formula

a(n) = (A102371(n) + n)/2 - 2^(n-1). - Philippe Deléham, Mar 27 2005
G.f.: Sum_{k>=1} 2^(k-1) x^(k+2^k)/(1 - x^(2^k)). - Robert Israel, Jan 21 2017
Conjecture: a(n) = (b(n) - b(n-1) - 1)/2 for n > 1 where b(n) = Sum_{k=0..A000523(n)} c(n-k, k) and c(n, m) = n - (n mod 2^m) with a(1) = 0. - Mikhail Kurkov, Jun 01 2022
Showing 1-10 of 14 results. Next