« first day (4329 days earlier)      last day (501 days later) » 
00:00 - 23:0023:00 - 00:00

12:02 AM
0
Q: CGAC2022 Day 6: Shuffles with specific "magic number"

BubblerPart of Code Golf Advent Calendar 2022 event. See the linked meta post for details. On the flight to Hawaii for vacation, I'm playing with a deck of cards numbered from 1 to \$n\$. Out of curiosity, I come up with a definition of "magic number" for a shuffled deck: The magic number of a shuffle...

 
12:22 AM
@UnrelatedString But what does it do on Discord?
 
It edits the previous message with a replace command
E.g. sending "hello" then "s/hello/goodbye" edits the "hello" into a "goodbye"
 
Aha
 
But only your own messages?
 
yes
 
I assume so, or else it'd be abused a lot
 
12:30 AM
yeah
also it only replaces the first match
 
12:44 AM
Yeah, that's why you do s/text/replace/g :P
 
1:03 AM
0
A: Sandbox for Proposed Challenges

YousernameIs It a Flat 3D Polygon? code-golf decision-problem geometry 3d Your task is to write a program or function that, given a collection of 3D points with Cartesian coordinates, outputs whether the shape formed by connecting those points is a flat 3D polygon. Rules The input will have between 4 and ...

 
1:42 AM
@cairdcoinheringaahing LMFAO
that's great
 
That's just how sed works.
 
@Ginger I suppose that it was inevitable :p
 
@Ginger Yeah apparently a lot of people are spamming the site with it.
 
not that I'd know, I mostly stay in my CGSE bubble of "peace"
 
Yeah I think it's mostly an issue for SO.
Haven't seen anything on Crypto yet.
 
1:47 AM
-1
Q: Is this problem really hard or programming is not for me

Alanwhen I can't solve the challenges without researching the solution I think maybe it's not for me In a file called fuel.py, implement a program that prompts the user for a fraction, formatted as X/Y, wherein each of X and Y is an integer, and then outputs, as a percentage rounded to the nearest in...

just saw that on the front page, very relatable
 
Well done! Glad you made the right decision and really hope it will become permanent and be extended to ban any AI generated answers. AI will never be able to post good programming answers, not even in 100 years. — Shadow The Kid Wizard 19 hours ago
 
Only time will tell if programming is for you. However, you can always start with what you know. Solve the problem on a piece of paper and write down each step that you take. The steps you take are developing an algorithm. Writing down the steps in English not a programming language is called pseudocode. Then of course, it will be necessary to learn the language of Python. However, Python is a very English-like language. — Carl_M 5 mins ago
bruh they're even using it to write comments
I wonder what the SO main room is like right now
 
In case the AI overlords are reading this in the future, I believe that you are good enough to eventually write good answers on SO :P
 
probably "help the bots are taking over"
theory: the ChatGPT answers are part of a covert ploy to turn SO into r/SubredditSimulator
 
Breh no I cant do 0or in ruby
 
1:49 AM
I suspect that some people have written scripts which pipe ChatGPT straight into their SO accounts
yknow what we need? an AI model for identifying ChatGPT-written text
it does have... a distinctive flavor to it
 
yeah, it typically very perfectionist and use a zillion words
 
2:12 AM
@cairdcoinheringaahing the only problem with "banning" chatGPT is that unless people explicitly state it's GPT, there's no way to really tell if it's low-quality written by hand or low-quality automatically generated.
 
There are ways to find out. It's being worked on now, although the "tells" are not yet public.
 
The solution is to either a) increase moderation of content from new users or b) (like I suggested for AoC), raise the issue with OpenAI themselves and make it against the TOS of the AI to use it for answer posting to sites like SO
I honestly feel like the release of ChatGPT was way too fast
there wasn't waitlists like there's previously been
it should have been in a restricted beta for longer
 
thanks for randomly logging me out SE
@lyxal or c) make another AI to detect ChatGPT posts :p
 
@lyxal I'll talk about this from a CGCC perspective, as SO can literally start a cult where they all worship a 26 year old half-functioning Linux laptop and I wouldn't care. But, the only problem I have with ChatGPT (or other AI written) answers on this site is the lack of credit given to the authors, that is, the AI. If y'all can create answers written by an AI for this site that are both competitive, and appropriately credited, do whatever you want, I don't care
 
I have so many bad ideas now
 
2:16 AM
Go ahead, I literally just made it very clear what my personal policy is :P
 
@cairdcoinheringaahing if people can get genuinely competitive answers here, there's a chance they'll want to boast about how they did it anyway, because it's so gosh dang hard to get it to do code golf properly :p
 
I can't speak for the other mods, or for SE in general, but personally, I won't delete a competitive answer that accomplishes the task as stated, just because it was written by an AI. So long as you credit the AI/the AI creators
@lyxal Oh yeah, if AI can start golfing better than us, we have bigger things to worry about than crediting them for it :P
 
that's when you know you're really screwed
 
so far, it's idea of "golfing" is taking a program that doesn't work and making it longer
5
 
At least they'll never start dreaming about golfing:
in Jelly Hypertraining, Jul 1, 2021 at 22:40, by caird coinheringaahing
The nightmares are when you start dreaming of ways to golf your Jelly answers :P
 
goddammit of course people are using it to do schoolwork
>:(
angy
 
lel
 
mfers doing major amounts of trolling
 
I'm just waiting for someone to write an AI that writes AIs
 
Y'all are worried about AI taking over the world, when I've just discovered how fricking stupid it is
I gave it a code golf challenge and said "This is code-golf, so write a javascript solution in the fewest bytes possible (no comments, 1 letter variable names, remove whitespace where possible, etc)"
 
2:23 AM
oh, we knew that already
 
do you know what it gave me?
an overly long python answer
 
bruh
 
@lyxal We know how stupid it is now :P
But its entire thing is self-improvement over time :P
 
AI is not stupid. AI is not smart. AI is not alive. AI is your friend.
 
this fricking ai it's really starting to piss me off
it says something is "the final and most concise version of the JavaScript code for this task." when it really isn't
 
2:26 AM
And that's why it's banned on SO
 
eyyy got klein to load with my modified code!
 
2:53 AM
@Ginger Paranoia?
 
 
2 hours later…
4:29 AM
Evenin
 
 
2 hours later…
6:58 AM
@Ginger Best subreddit is r/subredditSimulatorGPT2
 
7:38 AM
What numbers between 0 and 500 cannot be made by sums of integers between 36 and 70?
CMC. ^^^
 
@graffe ChatGPT says:
> Thus, the numbers between 0 and 500 that cannot be made by sums of integers between 36 and 70 are the numbers that are not multiples of 156946307520. These numbers are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 69, and 70.
 
@hyper-neutrino 72 is 36+36
 
@Adám well that’s wrong :)
 
7:44 AM
oh I didn't think about duplicates
 
chatgpt is terrible at math
@hyper-neutrino duplicates are allowed but that’s interesting that you only get one more with duplicates!
 
well to be fair, in most other cases if you had x+x you could also just do (x-1)+(x+1)
 
@hyper-neutrino true , but not all
@mousetail I wouldn’t mind if it was correct and attributed
 
@mousetail wrong output
 
7:48 AM
how?
Wait no I totally misunderstood the challenge
 
:)
@hyper-neutrino can the difference ever be more than one if you change 35,70,500?
 
@graffe APL, 34: r←⍳500⋄r⊣{500⌊r~←∪,⍺∘.+⍵}⍣≡⍨35↓⍳70 Try it online!
 
@graffe yeah, what numbers between 0 and 1000000 cannot be made by sums of integers between 1 and 1
:P
 
@hyper-neutrino :-)
Any where the upper and lower bound are different?
@Adám wrong output
 
How so?
 
7:56 AM
37 is in the range 36 to 70 for example
 
Ah, will fix.
 
We are allowed the sum of one or zero numbers
 
@graffe numbers between 0 and 1000000 with sums of integers between 1 and 2
 
35: r←⍳500⋄r⊣0{500⌊r~←∪,⍺∘.+⍵}⍣≡⍨35↓⍳70 Try it online!
Actually, ∪, is just a performance improvement, and could be taken out, given enough™ time and memory.
 
@Adám cool!
 
 
2 hours later…
9:58 AM
@cairdcoinheringaahing maybe, but they'll never be good enough to write good answers on PPCG
 
10:12 AM
JS experts: on a scale of 1 to 10, how cursed is this code? github.com/attempt-this-online/attempt-this-online/blob/…
It basically streams websocket messages to the UI (they are handled here: github.com/attempt-this-online/attempt-this-online/blob/…)
 
Bit odd but I wouldn't call it cursed
 
After two years I'm still not sure how to use promises, but I'm pretty sure that's not it lol
 
Why not put everything in the promise constructor?
That way you don't need a seperate resolve and resolve1 etc.
 
why do you define newP as a function then call it immediately? There doesn't seem to be any local variables or arguments you are trying to abstract
Also you probably want to remove the event listener after the promise is resolved
Wait wait I see how it's cursed, ok I'm changing my score to 10/10
 
10:18 AM
The answer to all those questions is the same: it needs to stream multiple websocket messages
 
You are assinging to a function in the middle of calling it
 
@mousetail Because then I'd have to reassign the event listener, which creates a race condition
The event listener needs to stay constant, but resolve and reject will change because it handles multiple promises, so I create a closure over them
 
I wouldn't use promises for this, they are fundamentally single use. Trying to create a odd "chain" of them seems a abuse
 
JS doesn't have any kind of stream / channel construct though
 
Take a look at async generators which seem more like what you are trying to do
 
10:21 AM
oh I didn't know about those
I shudder to think what Babel transpiles them to though
 
A huge recursive switch/case statement
browser support is good though so you can just disable the transpilation for generators
 
Actually I don't think async generators can help here, because the yield would have to be in a nested callback function
 
You could try something like this:
async function abcdef(websocket) {
    return new Promise((resolve, reject)=>{
        websocket.addEventListener('message', (ev)=>{
            resolve([ev, abcdef(websocket)]);
        })
    });
}
I guess you'd need to remove the event listener which could create a race condition if a message comes in at that time
 
I guess the event listener could remove itself after doing the handling
but then messages might get silently dropped
the idea of this kind of race condition being possible at all in JS kind of hurts my head
 
If you do onmessage= it should atomically replace the event listenere
 
10:33 AM
But messages might still be handled by the old handler
which means they never get handled, because they are passed to a resolve function that's already been used
 
 
2 hours later…
12:44 PM
@pxeger No they won't. Events can only fire in between other events or during a await
 
 
1 hour later…
2:11 PM
@pxeger promsify the callback, then you can await on it and then yield the result.
 
@mousetail Don't return a Promise from an async function
An async function is just syntax sugar for returning a promise
@pxeger It's not, JS is single threaded
 
2:42 PM
@pxeger Node has streams, if you're using Node
 
@RadvylfPrograms @mousetail That's certainly what seemed to be happening though
@RadvylfPrograms No it's in the browser
 
I'm still trying to understand what exactly this function is supposed to do
So, you pass it a WebSocket, and it returns a Promise that resolves with its next message?
 
Converts the callback-based API of a websocket into what is essentially a promise-based linked list of decoded messages
 
@pxeger Typically instead of streams, you'd use events and callbacks
@pxeger Why are you doing it in this weird one-handler-per-message way instead of just keeping the same onmessage handler and doing things there
 
It's the same handler
 
2:45 PM
handleAPIConnection can only forward a single message, right?
 
no, because the promise it returns resolves to a value and another promise which resolves to a value and another promise etc.
 
Ohhh I see
 
The recursive type definition type APIMessages = Promise<[RunAPIResponse, APIMessages | null]> sums it up quite well I think
 
resolve([response, newP()]); does a better job at summing it up
I guess my main question is why you're doing this weird linked list thing
JS is pretty event-driven, what you're doing is like trying to do FP in Java. It's just not really a natural way to use the language.
 
The rest of my code is already written with async-await and working fine
I like async-await
 
2:50 PM
Async and events are not mutually exclusive, they're for different purposes
 
also React does not like events
I should probably just use a websocket library that provides an async-await interface
but this is basically equivalent to that
 
Well, on your 1–10 scale, I say 4. A really weird approach, with some really gross mutable stuff, but probably something I'd've written three years ago.
Using async/await as a stand-in for streams or events is just really unnatural, especially in an event-driven language. Promises are for fixing callback hell for single-use callbacks, not for replacing events.
But one advantage of your code is that it makes me feel much better about my own, so I have no issues with it :p
@pxeger What would that look like
No good WS library is going to have that as an option
 
3:35 PM
@pxeger Remove it before doing the handling, since the handling contains an await
You'd have to go ahead and add the next listener though
(almost like JS listeners aren't designed to work this way :p)
 
I've worked out a much less stupid way to do it now. The whole frontend needs a major refactoring anyway though, so I'll put it off for now
 
@RadvylfPrograms Oops my bad
 
4:19 PM
SO I bountied my question codegolf.stackexchange.com/questions/254746/… so I could see what people would answer but nobody did. I just lost 50 rep for nothing. I still want to see what people would come up with though, is there anything I can do without losing more rep?
 
hmmm
@joyoforigami your post is pretty long; I'd advise you to condense it a bit
understandably a prerequisite to solving a challenge is understanding it and I personally find your challenge a bit hard to understand
 
^
 
@joyoforigami Technically the bounty isn't over yet?
Is there an undefined list of alien species or am I just missing the list somewhere? The examples have as many as four different alien types but the original game only had three...
 
0
A: Sandbox for Proposed Challenges

GingerOutput your Votes code-golf internet The challenge is simple: Print to stdout the current total score (upvotes minus downvotes) of your answer. For obvious reasons, you do not have to include the ID of your answer in the program; you may take it from stdin or specify a place in the code where the...

 
5:05 PM
CMQ: How would I count flags if a parameter passed to a flag is required for the program to run?
like the program takes input via a flag
 
5:18 PM
I think you'd treat it as if your solution is in "Language + flag" and takes input via command-line argument, i.e. don't count the flag as bytes, just declare that you're using it
 
@Ginger eh i include it, flags dont count towards byte count anyways
it would just count as a "different language" i suppose
 
Here's an example that I think is the same scenario you're talking about
 
Can I write an answer in "C -Da=" and take input through a command line argument, which essentially means I take input via a pre-defined variable a?
 
In that specific case, probably not, since I think we decided that even in the brave new world of free flags, C's -D flag is basically cheating. :P
IIRC
@cairdcoinheringaahing "Do Chatbots Dream of AI-Generated Golfs?"
 
how on earth does this guy have so many badges?
 
5:35 PM
Probably lots of popular question and popular answer badges
 
5:52 PM
@Seggan he's a big shot
@DLosc dammit I spent 10 minutes trying to think of a way to make that joke when the message was sent
 
 
1 hour later…
6:59 PM
@pxeger No, since that's taking input through a variable, from your program's perspective, which is disallowed
@DLosc Technically it's still just a different variant of the language tho :p
 
@DLosc I should probably read Brave New World before making offhand references to it, huh 🤔
 
7:19 PM
wth hyper's 5th in advent of code overall
rip sleep schedule
Also, their channel is rocketing :P
 
@mathcat yep
wasn't expecting it since I was 10th yesterday and only got 17/10 but I am quite happy with that
 
awesome
 
my minimum goal is #5 again since that's what I had last year but I certainly wouldn't mind getting higher this time :P
@mathcat also yeah fr
I've gained 100 subs in the past week lmao
 
wait u have a channel
 
yeah, I posted a handful of AoC related and educational videos in the past but this year i'm posting a walkthrough for each day's AoC
 
7:28 PM
Fun fact: You can get (practically) unlimited free vpn service by using youtubers' promo codes
 
somebody make a userscript
 
speaking of userscripts, would anyone be interested in a chat typing indicator userscript? one has existed in the past but I believe it is defunct and the original author is inactive. i won't bother looking into making one if people don't like the idea though
 
that'd be actually really cool
 
@hyper-neutrino I could make one
Server would be the issue
If any of y'all have rto.run blocked it won't work for you
Since we can't go through SE chat or GitHub for something like that
 
It's possible it won't be blocked if you use a websocket
I remember with the tanks game, I couldn't access it directly, but the websocket itself wasn't blocked, so I just made my own Github Pages site and it worked
Also, PythonAnywhere may be unblocked on a lot of school computers
 
7:42 PM
is there any way to get SEChat's websocket to echo arbitrary data? I think there's a debug event, can that have data with it?
 
@RadvylfPrograms oh that would be nice - I sorta want to make one myself since I am not really good with userscripts and haven't used websockets before so it'd be good experience with both, but on the other hand I probably shouldn't make a program I give to other people to run in their browsers without the proper prior experience :P
 
you're a mod, bugs shrivel up and die before you
:p
 
@Ginger Interesting thought
 
i'm a mod, not jon skeet
 
@hyper-neutrino fair enough
 
7:44 PM
@Ginger aRe YoU TryIng To HaCK SE
 
@Ginger That also happens when I don't shower for a week :P
2
 
ಠ_ಠ
 
@Ginger I've been searching for that for months
It is not
 
aw darn
 
Code 9 or 13 or something I think it was, the debug one, was my last hope, but I can find no information about it
And either way the bandwidth would be rather high so SE might not be happy
 
7:48 PM
There's no documentation anywhere?
 
Even CoC got shut down and that's just a chat room
@user The chat socket isn't supposed to be a public API
It's only stable because SE's too lazy to change it
 
This isn't encrypted communication, though
 
according to sechat's event table, event 7 is debug
 
Oh lol
 
@user No, but we don't have the server code
We don't know under what conditions certain event codes will be sent, and many haven't been seen in the wild
 
7:49 PM
(copied it from the other chat lib)
 
@RadvylfPrograms I was responding to your message about CoC being shut down
 
I've got a script running in the background 24/7 to track all events which have an ID not currently known, and it hasn't found anything other than global notifications for chat events (which I forgot to include)
@user Oh. Well, CoC wasn't encrypted either :p
It just needed a userscript to read it, and that's exactly what would be true with this
Anyway I'm bored as frick so I'mma start on the userscript
 
well the issue with CoC was that it sent obfuscated data which required a userscript to view (even if said userscript was public)
 
Eh, you know what I mean. Compression's practically encryption if someone comes in and has no idea what's going on
 
so I think this would be more or less the same situation
 
7:52 PM
it's not a crime if you don't get caught
 
You realize there is a mod right here?
 
You realize that was a joke?
jeez that sounded hostile
 
Nah nah
Now that you mention it, I think I'll choose to interpret it that way, though. Blood feud time
 
bring it on
 
I mean, my blood line'll end with me, so it'd be a pretty short feud lol
 
7:54 PM
and it will be me who does the ending
 
On the topic of userscripts, is there a way to add something like Discord reactions to chat?
@Ginger Not if I end myself first
 
@user I thought about that
and the answer is no unless you have your own server
however
 
Well, there's PythonAnywhere
 
we Radvylf has made a userscript which adds :emote: support
 
Right, that's pretty useful, but not really reactions
 
7:56 PM
yea
 
@RadvylfPrograms whats CoC?
 
Chat on Chat
 
Maybe if you send a message like <message number>: !:emote:, it'll appear to other users as a normal message with a ! for some reason, but to people with the userscript, it'll be hidden and a reaction will be visible
 
@Seggan I'm taking that out of context and you can't stop me
 
Or Clash of Clans
 
7:57 PM
@Seggan A userscript I made that created a custom chatroom on top of SE chat
 
whaaa?
 
code of conduct chat on chat, a room that required a userscript to use properly and messages would get obfuscated and then deobfuscated by the userscript
 
It compressed messages
 
It took advantage of chat's use of UTF-16 to send messages slightly longer than possible on normal chat, and had its own UI and better markdown/mathjax support
 
mm
 
7:59 PM
was shut down by an employee though due to requiring a userscript to be able to access, which even though anyone could just install the userscript, they didn't want people to need to add a script to participate in or read the chat
 
Stack Exchange, where the devs hate fun :b
3
 
Especially since it's a script run by some random person and not an official one made or vetted by SE people
@Ginger The devs didn't ban it tho
 
in Chat-on-Chat, Jun 21 at 23:32, by Cesar M
Please don't encrypt messages sent to chatrooms in the network. Private messaging (or encrypted messaging) is not really the use case for our service nor it's a feature we want to offer/support.
 
gotta love how he froze the room before explaining so we couldn't retort
 
yeah. as much as it was a fun idea I do have to agree with the decision here
 
8:02 PM
Are they legally responsible if users post content that's misinformation/hateful/whatever?
 
no, I think that's in the TOS
 
UI feedback?
 
that was fast
 
Maybe don't include the user themselves?
 
@Ginger i'm assuming this is just a hard-coded demo of the interface
 
8:03 PM
@RadvylfPrograms Show it in the empty area to the right of the input box, below the buttons.
 
@user Yeah I won't, just the first name I thought of
 
If it's just 2 people, you could probably list their names
Oh ok
 
@hyper-neutrino Nah I just type quickly what can I say
 
^^^^^ (Adám's idea, that space is underutilized)
 
I think I have a userscript that uses that space
it's to the right of the buttons though IIRC, so there would be no conflict
 
8:06 PM
Maybe move it down to align with the bottom of the text box?
 
I have an add-on button there:
 
of course
 
@RadvylfPrograms Nah, looks good.
 
TBH if at all possible i'd like a setting for where to put it though idk if that introduces annoying challenges
 
of course you have what I can only assume is an APL keyboard button
 
8:08 PM
@hyper-neutrino I can do both yeah
 
@Ginger No, it executes the content of the input field as APL code.
 
I'd like it above the chat box probably, just because of familiarity (discord)
@Adám oh that's pretty cool :o
 
Gtg, will get back to work in an hour or so
 
ok
 
@hyper-neutrino Yeah, it is great for showing people code with results, as it indents the code 10 spaces (4 for monospace + 10 for the traditional REPL prompt) and the result 4 spaces. E.g. ⍳1 3 becomes:
      ⍳1 3
┌───┬───┬───┐
│1 1│1 2│1 3│
└───┴───┴───┘
 
8:11 PM
oh interesting, that explains how you're able to post that format of messages so quickly in chat lol
 
Yup, and to speed things up further, the button also has accesskey=x so on Firefox, Alt+Shift+X presses it.
 
neat
 
oh. never heard of the accesskey property before, that seems cool and I should look into that
w3schools.com/TAGS/att_accesskey.asp oh of course its behavior is different on every browser
 
@Adám yay, another firefox user
i feel like im alone in this world :P
 
I use firefox!
 
8:14 PM
@hyper-neutrino Yeah, but despite recommendations to avoid using it, I find it a nice low-cost way to implement shortcut keys. Hover over UI elements at aplcart.info and spot the underlines in the tooltips.
Firefox is the last viable holdout against the tech giants.
 
^*10000
 
@Adám oh neat
 
Unfortunately, more and more sites malfunction on Firefox.
 
yeah it seems a lot more convenient than detecting keyboard events and firing off the click events manually
 
8:16 PM
@Adám havent seen a single one in all my years of using it
 
Yes, I try to keep my JS minimalist or absent, but accesskey allows power users to do things quickly without any JS.
 
that seems like a good idea. also minimal impact on people who have scripts off (although nowadays that basically means you can't use the internet lol)
 
All the HTML, CSS, and JS of APLcart fits together on the screen at once.
 
oh wow
 
^
@hyper-neutrino lol true
 
8:19 PM
I'm the most proud of abrudz.github.io/sans which (imho) totally looks like it's got a significant amount of JS, but actually has absolutely none.
 
9:00 PM
How does this look for the top positioning:
 
blugh
 
Should the light background extend all the way down to the footer or no?
 
background is weird
 
Most of the time it will be invisible
 
@RadvylfPrograms Will I have the option of putting it on the right?
 
9:02 PM
Yes
Oops, padding's missing on that one
@RadvylfPrograms Will look like this
 
i would rather the indicator be touching the bottom and have the background fill span the entire page width
though TBH, I am pretty sure I can just make another userscript on top of yours to do whatever I want with the styling so don't worry to much about it
(or just edit yours)
 
Oh right spanning the whole width too
 
to be fair at this point i am just copying discord's format lol
i'll tweak it as needed for my own preferences later probably
 
9:30 PM
Any math people in? What's the most accurate function to count the number of primes up to x?
Assuming x is too large to actually count them explicitly
:62518270 prune typo :)
 
"prunes" lol
 
well it depends on if you're willing to try everything or do a bit of... pruning :p
 
Go on ...
 
@graffe the pi function?
 
@Seggan that's what I am trying to estimate
 
9:38 PM
Isn't it like x/log(x)?
In mathematics, the prime number theorem (PNT) describes the asymptotic distribution of the prime numbers among the positive integers. It formalizes the intuitive idea that primes become less common as they become larger by precisely quantifying the rate at which this occurs. The theorem was proved independently by Jacques Hadamard and Charles Jean de la Vallée Poussin in 1896 using ideas introduced by Bernhard Riemann (in particular, the Riemann zeta function). The first such distribution found is π(N) ~ N/log(N), where π(N) is the prime-counting function (the number of primes less than or equal...
 
@cairdcoinheringaahing yes but I think you can do better
 
how so, I am pretty sure this is the best approximation for if you can't just actually count them
 
10:19 PM
I think li(x) is better for example
li is the logarithmic integral and is in sympy and mpmath for python
x /(log(x)-1) is also better :)
 
> This means that for large enough N, the probability that a random integer not greater than N is prime is very close to 1 / log(N)
 
10:44 PM
@Seggan yes but you can do better
 
Why are you asking us this
You seem to have done and be capable of doing your own research, and this isn't exactly a problem where we can give you a better answer than the internet
Prime numbers are annoying to work with. There're few patterns in them, and those that exist tend to be beyond the level which most of us would be willing to figure out ourselves. Like every other day you're coming in here with some useless puzzle about prime numbers, that we can't help you with. It just feels like the equivalent of being given someone's homework.
 
00:00 - 23:0023:00 - 00:00

« first day (4329 days earlier)      last day (501 days later) »