3 ms·
For those who are not impressed when they enter "3" and "444", try something like "8239419503490293592", and prepare to be blown away.
by projectramo 8y ago
For those who are not impressed when they enter "3" and "444", try something like "8239419503490293592", and prepare to be blown away.
- jkuria 8y agoYes, now I am impressed!
- lucb1e 8y agoI figured it had small cases down so I immediately went for a fifteen digit number from /dev/urandom and was happy that it solved it perfectly. But I'm probably the exception. For those wondering how to generate random numbers, it's simple if you don't care about a little computational overhead: </dev/urandom tr -dc 0-9 | head -c 15 (substitute 0-9 for any character set like a-zA-Z or \ -~). I use this to generate random PIN numbers after it took too long to read the pwgen man page, and I might start to use it as replacement for pwgen altogether since it only uses very basic tools that are available everywhere, unlike pwgen. To explain the command: we read urandom into tr's stdin; tr translates (like "echo haha | tr a u"); with -d, tr deletes instead of substituting; with -c, it takes the compliment set (so everything except what you specify). Basically we're filtering characters or of urandom's output. Finally, we limit the output to a certain number of characters.
- ConceptJunkie 8y agoThe paper gives a detailed algorithm to provide 3 palindrome that add up to the number. The algorithm has tons of cases, but it's actually pretty simple. They work through a couple in the video. It's a cool result.
- EForEndeavour 8y agoCool one-liner to get random digits. On OSX, it produces the error "tr: Illegal byte sequence." The solution, per https://unix.stackexchange.com/q/45404 https://unix.stackexchange.com/q/45404, is to prepend the script with "LC_CTYPE=C ": LC_CTYPE=C </dev/urandom tr -dc 0-9 | head -c 15
- mikkelam 8y agoExcept now I have to wait for the digits to appear...