Search:

Type: Posts; User: johan.g1

Search: Search took 0.01 seconds.

  1. Replies
    18
    Views
    2,877

    Sorry, but I don't understand what you guys are...

    Sorry, but I don't understand what you guys are talking about. :confused: (I'm almost a complete beginner in programming.) How exactly did you make it to 500 million?
  2. Replies
    18
    Views
    2,877

    I thought my method above is the Sieve of...

    I thought my method above is the Sieve of Eratosthenes? Here's what I got.


    Note: These are your highest values: for an unsigned long int: 18446744073709551615
    and...
  3. Replies
    18
    Views
    2,877

    Efficient large prime checker

    I need check large integers (up to 10 million) for primality. My usual way is as follows:



    int prime[MAX] = {0}, i, j;

    for(i=2;i<MAX;i++)
    prime[i] = 1;

    for(i=2;i<MAX;i++)
  4. Replies
    3
    Views
    851

    Ah, stupid mistake. It does work now, thanks! ...

    Ah, stupid mistake. It does work now, thanks!

    I don't completely get the mechanism though. Why exactly the array is shifted when I initialized "int sum=0"?
  5. Replies
    3
    Views
    851

    Array shifted when initializing variable

    I'm working on Project Euler 22. I think I got the logic and my code is a step away from the answer. But something creepy is going on.

    Basically I have four functions: "read" to read the input of...
  6. I see. Thanks!

    I see. Thanks!
  7. Array manipulation doesn't work in printf

    I have this void function that modifies an array count[]. When I call this function inside printf, and print the resulting count[0] in the same printf, why isn't the array modified?

    ...
  8. Replies
    6
    Views
    1,690

    Thanks. I think I got it now. :D

    Thanks. I think I got it now. :D
  9. Replies
    6
    Views
    1,690

    Pointer Initialization

    I was having a lecture about pointers and I thought I understood already. Until I tried this simple code that doesn't work. It gives "Segmentation fault: 11".


    #include<stdio.h>

    int main()
    {...
Results 1 to 9 of 10