Skip to main content
added 22 characters in body
Source Link
Kirill L.
  • 14.3k
  • 2
  • 17
  • 54

Ruby, 86 8484 78 bytes

->n{1.step{|x|a=[];n|x,*a|x==(n.times{a<<x;x=a|=[x=(1...x).sum{|i|x%i>0?0:i}]};p(a;a[n-1])if a.rindex&&p(xa)==0}} 

Try it online!Try it online!

Prints the sequence for a given \$n\$ infinitely.

6 bytes saved by G B.

Ruby, 86 84 bytes

->n{1.step{|x|a=[];n.times{a<<x;x=(1...x).sum{|i|x%i>0?0:i}};p(a)if a.rindex(x)==0}} 

Try it online!

Prints the sequence for a given \$n\$ infinitely.

Ruby, 86 84 78 bytes

->n{1.step{|x,*a|x==(n.times{a|=[x=(1...x).sum{|i|x%i>0?0:i}]};a[n-1])&&p(a)}} 

Try it online!

Prints the sequence for a given \$n\$ infinitely.

6 bytes saved by G B.

added 7 characters in body
Source Link
Kirill L.
  • 14.3k
  • 2
  • 17
  • 54

Ruby, 8686 84 bytes

->n{1.step{|x|a=[];n.times{a<<x;x=(1...x).sum{|i|x%i>0?0:i}};a|[]==a&&x==a[0]?p;p(a):pif a.rindex(x)==0}} 

Try it online!Try it online!

PrintPrints the sequence for a givegiven \$n\$ infinitely.

Ruby, 86 bytes

->n{1.step{|x|a=[];n.times{a<<x;x=(1...x).sum{|i|x%i>0?0:i}};a|[]==a&&x==a[0]?p(a):p}} 

Try it online!

Print the sequence for a give \$n\$ infinitely.

Ruby, 86 84 bytes

->n{1.step{|x|a=[];n.times{a<<x;x=(1...x).sum{|i|x%i>0?0:i}};p(a)if a.rindex(x)==0}} 

Try it online!

Prints the sequence for a given \$n\$ infinitely.

Source Link
Kirill L.
  • 14.3k
  • 2
  • 17
  • 54

Ruby, 86 bytes

->n{1.step{|x|a=[];n.times{a<<x;x=(1...x).sum{|i|x%i>0?0:i}};a|[]==a&&x==a[0]?p(a):p}} 

Try it online!

Print the sequence for a give \$n\$ infinitely.