Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 1125 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ Collatz Conjecture

#1
I was watching a bunch of numberphile videos, which gave me the idea to make a ridiculously optimized program that finds out how many iterations are needed to complete the collatz conjecture for any given number. I originally made it with Python, but wasn't satisfied with the speeds I was getting (~373 ms for 1-100), so I went ahead and ported it to C++. Originally, I used uint, but as I tested it with higher values, I found that that wouldn't cut it, so I'm now running with monster unsigned long long integers, which are guaranteed to be >64 bits.

Source:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Powershell Measure-Command benchmark:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Fun fact: while torture testing the program (and I guess my laptop as well), I found that the number under 100,000,000 that requires the most steps to complete the conjecture is 63,728,127 with 949 iterations.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through