Skip to main content
added 454 characters in body
Source Link
loopy walt
  • 16.9k
  • 2
  • 12
  • 70

Python, 54 bytes

j=k=t=2 while t:=k%2>0!=print(t)or-~t:k=k//2or(j:=-~j)

Attempt This Online!

This version consistently outputs True for 1.

Old Python, 57 bytes

j=k=1 while[print(t:=len(f"{k&-k:b}"))]:k=k>>t or(j:=-~j)

Attempt This Online!

Old Python, 63 bytes (@pxeger)

j=k=1 while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;print(t)

Attempt This Online!

Old Python, 73 bytes

def f(j=1,k=1): while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;yield t

Attempt This Online!

This goes through all positive integers and outputs for each the sequence of distances between 1s in its binary representation.

For example:

1616 -> 11001010000 -> 5,2,3,1 

Python, 53 bytes

j=k=t=1 while k:=k//t or(j:=j+(t:=1)):print(k%t);t+=1

Attempt This Online!

Port of @Polichinelle's JS answer.

Python, 54 bytes

j=k=t=2 while t:=k%2>0!=print(t)or-~t:k=k//2or(j:=-~j)

Attempt This Online!

This version consistently outputs True for 1.

Old Python, 57 bytes

j=k=1 while[print(t:=len(f"{k&-k:b}"))]:k=k>>t or(j:=-~j)

Attempt This Online!

Old Python, 63 bytes (@pxeger)

j=k=1 while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;print(t)

Attempt This Online!

Old Python, 73 bytes

def f(j=1,k=1): while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;yield t

Attempt This Online!

This goes through all positive integers and outputs for each the sequence of distances between 1s in its binary representation.

For example:

1616 -> 11001010000 -> 5,2,3,1 

Python, 54 bytes

j=k=t=2 while t:=k%2>0!=print(t)or-~t:k=k//2or(j:=-~j)

Attempt This Online!

This version consistently outputs True for 1.

Old Python, 57 bytes

j=k=1 while[print(t:=len(f"{k&-k:b}"))]:k=k>>t or(j:=-~j)

Attempt This Online!

Old Python, 63 bytes (@pxeger)

j=k=1 while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;print(t)

Attempt This Online!

Old Python, 73 bytes

def f(j=1,k=1): while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;yield t

Attempt This Online!

This goes through all positive integers and outputs for each the sequence of distances between 1s in its binary representation.

For example:

1616 -> 11001010000 -> 5,2,3,1 

Python, 53 bytes

j=k=t=1 while k:=k//t or(j:=j+(t:=1)):print(k%t);t+=1

Attempt This Online!

Port of @Polichinelle's JS answer.

added 428 characters in body
Source Link
loopy walt
  • 16.9k
  • 2
  • 12
  • 70

Python, 5754 bytes

j=k=t=2 while t:=k%2>0!=print(t)or-~t:k=k//2or(j:=-~j)

Attempt This Online!

This version consistently outputs True for 1.

Old Python, 57 bytes

j=k=1 while[print(t:=len(f"{k&-k:b}"))]:k=k>>t or(j:=-~j)

Attempt This Online!

Old Python, 63 bytes (@pxeger)

j=k=1 while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;print(t)

Attempt This Online!

Old Python, 73 bytes

def f(j=1,k=1): while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;yield t

Attempt This Online!

This goes through all positive integers and outputs for each the sequence of distances between 1s in its binary representation.

For example:

1616 -> 11001010000 -> 5,2,3,1 

Python, 57 bytes

j=k=1 while[print(t:=len(f"{k&-k:b}"))]:k=k>>t or(j:=-~j)

Attempt This Online!

Old Python, 63 bytes (@pxeger)

j=k=1 while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;print(t)

Attempt This Online!

Old Python, 73 bytes

def f(j=1,k=1): while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;yield t

Attempt This Online!

This goes through all positive integers and outputs for each the sequence of distances between 1s in its binary representation.

For example:

1616 -> 11001010000 -> 5,2,3,1 

Python, 54 bytes

j=k=t=2 while t:=k%2>0!=print(t)or-~t:k=k//2or(j:=-~j)

Attempt This Online!

This version consistently outputs True for 1.

Old Python, 57 bytes

j=k=1 while[print(t:=len(f"{k&-k:b}"))]:k=k>>t or(j:=-~j)

Attempt This Online!

Old Python, 63 bytes (@pxeger)

j=k=1 while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;print(t)

Attempt This Online!

Old Python, 73 bytes

def f(j=1,k=1): while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;yield t

Attempt This Online!

This goes through all positive integers and outputs for each the sequence of distances between 1s in its binary representation.

For example:

1616 -> 11001010000 -> 5,2,3,1 
added 349 characters in body
Source Link
loopy walt
  • 16.9k
  • 2
  • 12
  • 70

Python, 6357 bytes (@pxeger)

j=k=1 while[print(t:=len(f"{k&-k:b}"))]:k=k>>t or(j:=-~j)

Attempt This Online!

Old Python, 63 bytes (@pxeger)

j=k=1 while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;print(t)

Attempt This Online!

Old Python, 73 bytes

def f(j=1,k=1): while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;yield t

Attempt This Online!

This goes through all positive integers and outputs for each the sequence of distances between 1s in its binary representation.

For example:

1616 -> 11001010000 -> 5,2,3,1 

Python, 63 bytes (@pxeger)

j=k=1 while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;print(t)

Attempt This Online!

Old Python, 73 bytes

def f(j=1,k=1): while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;yield t

Attempt This Online!

This goes through all positive integers and outputs for each the sequence of distances between 1s in its binary representation.

For example:

1616 -> 11001010000 -> 5,2,3,1 

Python, 57 bytes

j=k=1 while[print(t:=len(f"{k&-k:b}"))]:k=k>>t or(j:=-~j)

Attempt This Online!

Old Python, 63 bytes (@pxeger)

j=k=1 while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;print(t)

Attempt This Online!

Old Python, 73 bytes

def f(j=1,k=1): while 1:j+=k<1;k=k or j;t=len(f"{k&-k:b}");k>>=t;yield t

Attempt This Online!

This goes through all positive integers and outputs for each the sequence of distances between 1s in its binary representation.

For example:

1616 -> 11001010000 -> 5,2,3,1 
added 377 characters in body
Source Link
loopy walt
  • 16.9k
  • 2
  • 12
  • 70
Loading
Source Link
loopy walt
  • 16.9k
  • 2
  • 12
  • 70
Loading