2
b2plane
1y

1. Went to try chat.openai.com/chat

2. "Write a java program that uses a singleon pattern to calculate the sum of the first 100 prime numbers"

3. ???? HOW DOES IT DO THAT

Comments
  • 1
    *function curve fitting
  • 0
    Magic!
  • 1
    Wanted to try it out but apparently they require your phone number for sign-up.. yucky
    And a bunch of ppl got scam calls shortly after that
  • 0
    Used your rant as input:

    Part < 1 / 3 >

    -------------------------

    The Singleton pattern is a design pattern that is used to ensure that there is only one instance of a class in a program. In the case of calculating the sum of the first 100 prime numbers, a singleton class could be used to implement a method that calculates and returns the sum. Here is an example of how this could be implemented in Java:

    public class PrimeNumberCalculator {

    // The Singleton instance

    private static PrimeNumberCalculator instance = null;

    // Private constructor to prevent instantiation

    private PrimeNumberCalculator() { }

    // Method to get the Singleton instance

    public static PrimeNumberCalculator getInstance() {

    if (instance == null) {

    instance = new PrimeNumberCalculator();

    }

    return instance;

    }
  • 0
    Part <2/3>

    --------------------------------------

    // Method to calculate the sum of the first 100 prime numbers

    public int sumOfFirst100Primes() {

    int sum = 0;

    int count = 0;

    int number = 2;

    while (count < 100) {

    if (isPrime(number)) {

    sum += number;

    count++;

    }

    number++;

    }

    return sum;

    }
  • 3
    @ElectroArchiver

    GPT is officially a terrible programmer for not implementing singleton right with that marvelous data race on the static getter xd
  • 1
    I'm quite certain openai has already been posting rants here on devrant.
  • 1
    If it is so good then why is it banned on stackoverflow? lol https://meta.stackoverflow.com/ques...
  • 1
    @cafecortado

    It's not good because it is accurate.

    By self-admission, it isn't.

    GPT is good because it outputs content that *seems* to be written by a human, even if it is incorrect.

    As they specifically detail in your link, the risk this poses is that it's *very* easy to generate answers that are *very* easily incorrect, and that is, understandably, something SO does not want.
Add Comment