rperce
Re:A regular expression to check for prime numbers
on Tuesday June 20, 2023 @09:52PM (#36413390)
I encourage you to re-read the article: you check that the number does not match the regex:
> Is 7 prime?
>
> To know this, the function first generates “1111111” (from “1” \* 7) and tries to
> see if that string does not match /^1?$|^(11+?)\1+$/. If there is no match, then
> the number is prime.
>
> Notice that the regular expression has two parts (separated with the vertical bar |).
>
> The first part is /^1?$/ is trivial and matches with beginning of line (^), an
> optional 1 (1?) and end of line ($) which implies that it matches either the
> empty string or “1”. This simply indicates that calling that function with n==0
> or n==1 will correctly return false (as the “1” \* n will match with the first
> part of the regular expression)
I agree that the article formatting is a bit misleading.
Re:Looking at a website turns Bing Chat into a scammer
on Tuesday February 28, 2023 @08:18PM (#34977484)
The dog wears a harness, and a strap clips into the buckle seat and onto the harness. When you get where you're going, you unclip the strap from the harness, clip on the leash, and off you go.
Re:The Zen of Forth
on Thursday December 29, 2022 @09:33PM (#34181086)
Yes, "programming nerd's ability at programming makes him an incredible actual wizard in FantasyLand" is the book. I would recommend it!
Re:Turning music into a chore is what finally made me a musician
on Friday November 11, 2022 @11:08PM (#33569854)
I'm not the person you asked, but if I had to guess, I'd guess [beeminder]: goal-tracking software where if you don't reach your goal, they charge your credit card. Each time you fail, you get charged more. It's really good!
[beeminder]: https://www.beeminder.com/
Re:Ask HN: Side projects that are making money, but you'd not talk abo...
on Saturday June 06, 2020 @10:36AM (#23439461)
I mean, you did ask for projects people would usually rather not talk about.
Re:Amazon is stuffing its search results pages with ads
on Tuesday September 11, 2018 @07:35PM (#17964366)
When is that article from? I can't find a date. Am interested to know if the suit has progressed.
Re:Why Does Windows Think My Keyboard Is a Toaster? (2014)
on Monday April 04, 2016 @04:54PM (#11425568)
I go to school with that fella
Re:Sphere Packing Solved in Higher Dimensions
on Thursday March 31, 2016 @12:00PM (#11398122)
That was one hell of a ride. Great explanations, really enjoyed it!
Re:Fake Meetings for People with Too Many Real Meetings
on Wednesday March 30, 2016 @08:18PM (#11394090)
Do you know you're allowed to swear on the Internet? It's okay, I promise
Re:Fake Meetings for People with Too Many Real Meetings
on Wednesday March 30, 2016 @08:16PM (#11394080)
Do you know, you're allowed to swear on the Internet? It's okay, I promise.