Timeline for How can I get a repdigit?
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Aug 24, 2016 at 14:16 | history | suggested | SQB | CC BY-SA 3.0 |
I was like, "huh?", until I realised you typed 87654321 backwards a couple of times.
|
Aug 24, 2016 at 13:15 | review | Suggested edits | |||
S Aug 24, 2016 at 14:16 | |||||
Aug 24, 2016 at 8:40 | comment | added | Kevin Cruijssen | Amazing approach. It may be slightly longer in terms of bytes for Python 2, but it saves a whopping 40 bytes in Java 7, so thanks. :) (Also thanks a lot for the "How it works" part.) | |
Aug 24, 2016 at 7:53 | comment | added | shooqie |
@Dave: Huh, it's interesting actually. I always assumed that closed-form formula == O(1) , but I guess it makes sense.
|
|
Aug 24, 2016 at 7:51 | comment | added | Dennis | @shooqie I've edited my answer. | |
Aug 24, 2016 at 7:51 | history | edited | Dennis | CC BY-SA 3.0 |
added 317 characters in body
|
Aug 24, 2016 at 7:45 | history | edited | Dennis | CC BY-SA 3.0 |
added 317 characters in body
|
Aug 24, 2016 at 7:32 | comment | added | shooqie |
Would you mind explaining the logic behind this formula? Baffles me how it's O(1) .
|
|
Aug 24, 2016 at 7:27 | comment | added | xnor |
Another 41 is lambda n:10**len(`n`)/9*-~int(`n*9`[0])-n . It almost works to do lambda n:int(`n*9`[0]*len(`n`))-n , but the digit is one too small and I don't see a good way to fix it.
|
|
Aug 24, 2016 at 7:08 | history | answered | Dennis | CC BY-SA 3.0 |