Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Ruby 27

A very slightly modified version of this (viavia):

puts <<3*3,3
puts <<3*3,3
3

The number of times that puts-line is printed grows exponentially.

$ ruby quine.rb | ruby | ruby
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
3

$ ruby quine.rb | ruby | ruby | ruby | ruby | ruby | ruby | ruby | wc -l
    3283
    

Ruby 27

A very slightly modified version of this (via):

puts <<3*3,3
puts <<3*3,3
3

The number of times that puts-line is printed grows exponentially.

$ ruby quine.rb | ruby | ruby
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
3

$ ruby quine.rb | ruby | ruby | ruby | ruby | ruby | ruby | ruby | wc -l
    3283
    

Ruby 27

A very slightly modified version of this (via):

puts <<3*3,3
puts <<3*3,3
3

The number of times that puts-line is printed grows exponentially.

$ ruby quine.rb | ruby | ruby
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
3

$ ruby quine.rb | ruby | ruby | ruby | ruby | ruby | ruby | ruby | wc -l
    3283
    
Only 3's looks nicer I guess
Source Link
daniero
  • 18.7k
  • 5
  • 51
  • 78

Ruby 27

A very slightly modified version of this (via):

puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
23

The number of times that puts-line is printed grows exponentially.

$ ruby quine.rb | ruby | ruby
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
puts <<2*3<<3*3,23
23

$ ruby quine.rb | ruby | ruby | ruby | ruby | ruby | ruby | ruby | wc -l
    3283
    

Ruby 27

A very slightly modified version of this (via):

puts <<2*3,2
puts <<2*3,2
2

The number of times that puts-line is printed grows exponentially.

$ ruby quine.rb | ruby | ruby
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
2

$ ruby quine.rb | ruby | ruby | ruby | ruby | ruby | ruby | ruby | wc -l
    3283
    

Ruby 27

A very slightly modified version of this (via):

puts <<3*3,3
puts <<3*3,3
3

The number of times that puts-line is printed grows exponentially.

$ ruby quine.rb | ruby | ruby
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
puts <<3*3,3
3

$ ruby quine.rb | ruby | ruby | ruby | ruby | ruby | ruby | ruby | wc -l
    3283
    
deleted 284 characters in body
Source Link
daniero
  • 18.7k
  • 5
  • 51
  • 78

Ruby 5327

Tried to make an incrementalA very slightly modified version of this (via thisvia), but it didn't quite turn out the way I wanted.:

c=2
puts "c=#{c}+1",<<2*c<<2*3,2
puts "c=#{c}+1",<<2*c<<2*3,2
2

c isn't incremented after the second run. Instead the The number of times that puts-line is printed grows somewhat exponentially:.

$ ruby quine.rb | ruby | ruby | ruby
c=2+1
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
puts "c=2+1",<<2*c<<2*3,2
2

$ ruby quine.rb | ruby | ruby | ruby | ruby | ruby | ruby | ruby | wc -l
1097    3283
    

Ruby 53

Tried to make an incremental version of this (via this), but it didn't quite turn out the way I wanted.

c=2
puts "c=#{c}+1",<<2*c,2
puts "c=#{c}+1",<<2*c,2
2

c isn't incremented after the second run. Instead the number of times that puts-line is printed grows somewhat exponentially:

$ ruby quine.rb | ruby | ruby | ruby
c=2+1
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
puts "c=2+1",<<2*c,2
2

$ ruby quine.rb | ruby | ruby | ruby | ruby | ruby | ruby | ruby | wc -l
1097
    

Ruby 27

A very slightly modified version of this (via):

puts <<2*3,2
puts <<2*3,2
2

The number of times that puts-line is printed grows exponentially.

$ ruby quine.rb | ruby | ruby
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
puts <<2*3,2
2

$ ruby quine.rb | ruby | ruby | ruby | ruby | ruby | ruby | ruby | wc -l
    3283
    
added 90 characters in body
Source Link
daniero
  • 18.7k
  • 5
  • 51
  • 78
Loading
Source Link
daniero
  • 18.7k
  • 5
  • 51
  • 78
Loading