Jump to content

Count to 10,000!


Pleeb

Recommended Posts

  • Replies 2.3k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

1433 I wonder what percentage of the numbers from 1 to 10,000 have their digits in consecutive order.

 

EDIT: 1,675 of them do.

 

1.upto(10_000).find_all{|i| a = i.to_s.chars.to_a; a == a.sort || a == a.sort.reverse}.count #=> 1675

I don't visit as often as I used to. If you want me to see something, make sure to quote a post of mine or ping me @jean-luc

Link to comment
Share on other sites

1436

 

$ sleep >> /dev/bin

 

What? `sleep` needs an amount of time to sleep as an argument, it doesn't output anything, and /dev/bin isn't usually a file on most systems.

Am I missing something here?

I don't visit as often as I used to. If you want me to see something, make sure to quote a post of mine or ping me @jean-luc

Link to comment
Share on other sites

1439 It requires a number on my system. Even if it's a valid command, it still doesn't make sense why it would exist.

 

1437

 

Yes. The number is optional. You can legally redirect the output of a command that produces no output. And the file being directed to does not need to exist.

I don't visit as often as I used to. If you want me to see something, make sure to quote a post of mine or ping me @jean-luc

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...