Skip to main content
added 52 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70

Wolfram Language (Mathematica), 35 34 bytes

#0[#+1/If[++i#>1,-Echo@i,i]]&[i=1] 

Try it online!

Outputs the sequence indefinitely (up to $IterationLimit, 4096 by default).

Subtracts terms from 1 instead of adding from 0.


Without overriding $IterationLimit, 40 bytes:

i=0;Do[i+=1/If[i>1/j,-Echo@j,j],{j,∞}] 

Try it online!

Wolfram Language (Mathematica), 35 34 bytes

#0[#+1/If[++i#>1,-Echo@i,i]]&[i=1] 

Try it online!

Outputs the sequence indefinitely (up to $IterationLimit, 4096 by default).


Without overriding $IterationLimit, 40 bytes:

i=0;Do[i+=1/If[i>1/j,-Echo@j,j],{j,∞}] 

Try it online!

Wolfram Language (Mathematica), 35 34 bytes

#0[#+1/If[++i#>1,-Echo@i,i]]&[i=1] 

Try it online!

Outputs the sequence indefinitely (up to $IterationLimit, 4096 by default).

Subtracts terms from 1 instead of adding from 0.


Without overriding $IterationLimit, 40 bytes:

i=0;Do[i+=1/If[i>1/j,-Echo@j,j],{j,∞}] 

Try it online!

Source Link
att
  • 22.8k
  • 2
  • 19
  • 70

Wolfram Language (Mathematica), 35 34 bytes

#0[#+1/If[++i#>1,-Echo@i,i]]&[i=1] 

Try it online!

Outputs the sequence indefinitely (up to $IterationLimit, 4096 by default).


Without overriding $IterationLimit, 40 bytes:

i=0;Do[i+=1/If[i>1/j,-Echo@j,j],{j,∞}] 

Try it online!