6 ms·
Does anybody know how to do math with regex? (triples) And conditionals don't seem to work?
by The_Double 13y ago
Does anybody know how to do math with regex? (triples)
And conditionals don't seem to work?
- danielweber 13y agoMy guess is that 147 must appear the same number of times as 258, but I'm not sure if that's even expressible in regexp.
- recursive 13y agoNo. 111 is a multiple of 3.
- johnlbevan2 13y agoSadly that wouldn't work for: 140091876 147 = 4 times 258 = 1 time
- johnlbevan2 13y agoRefined: [0369] can appear any number of times [147] and [258] must appear an equal number of times, or for any remaining: [147] must appear a multiple of 3 times [258] must appear a multiple of 3 times
- dudus 13y agoFrom: http://quaxio.com/triple/ http://quaxio.com/triple/ ^([0369]|[258][0369]*[147]|[147]([0369]|[147][0369]*[258])*[258]|[258][0369]*[258]([0369]|[147][0369]*[258])*[258]|[147]([0369]|[147][0369]*[258])*[147][0369]*[147]|[258][0369]*[258]([0369]|[147][0369]*[258])*[147][0369]*[147])*$
- moron4hire 13y ago569pts: ([^31]0|31|[017]2|[03]03|[^1]4|(900|01|7)5|6|[48]7|[57]8|09)$
- raverbashing 13y agoThe idea is as thus: Remember division rules? If the sum of digits is divisible by 3, then the number is divisible by 3 So, if you have 0, 3, 6, 9, it's as you can remove them, the value won't change Remaining are the 2, 3, etc digit numbers divisible by 3
- tcfunk 13y agoI got 187 with this [369](?![7238])|(?:0)12 It's sloppy and certainly not correct, but a decent score.
- galen_tyrol 13y ago^[01349][064] works for 197