This was one of the first exercises we received during my first year of programming. I was asked about it in an interview years ago and I also found it as a programming challenge in a website. For a given number, for example 723, find the sum of its digits. In our example is 7+2+3 which is 12. To my surprise, not everyone is able to find an elegant solution. I saw many trying to convert it to string and then loop though the characters etc. Here we will provide an elegant solution based on math and how integer division is working in most programming languages, including C#.
Prime number or Prime is a number greater than 1 that can be divided only by 1 and itself. In other words, it can’t be formed by multiplying two other numbers. The first ten prime numbers are: 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. 2 is the only even number that is prime. There are several ways to check for prime numbers and in some cases a brute force algorithm might not be a problem. If the system has restrictions or you are trying to solve a programming challenge with time restrictions then you need an algorithm that can find the answer fast. The method provided is simple and fast and used in many programming challenges with time restrictions.
The Least Common Multiple (LCM) or Lowest Common Multiple of two integers is the smallest integer that is divisible by both numbers. The method that is provided in this post uses the Greatest Common Divisor (GCD). This one line method calculates the LCM by leveraging the GCD, the code of the GCD method is provided in the GCD post.
I’ve decided to create a post series with methods I found useful, especially when solving programming challenges. The first one is how to calculate the Greatest Common Divisor (GCD) of two numbers. GCD is the largest number that divides both numbers without a reminder. We follow the Euclidean algorithm which is very simple and fast.
Shadow of War is a very nice game that I enjoyed very much. Yet another game though that save game got corrupted and lost my progress. This is happening to almost all the latest games that I played and it is very frustrating. In this post I will show you where you can find the save game, back it up and restore it when corruption happens or when you want to revert to a previous one. Also, you will find some of my save games I was backing up while I was playing the game. This way if it happened and lost your progress without a backup, you can use one of mine.
A plugin caused almost all links to the files to be not accessible. Plugin was upgraded but all posts that had links needed to be updated too so it took a lot of time and effort to restore all links but it is now done. If you find any link that is not working please let me know through comments
Segregated Witness, also known as SegWit, has locked in on Bitcoin it will be activated soon. This happened after many months of debates on how to scale Bitcoin and after the hard fork by some miners. SegWit will change Bitcoin in many ways. I will mention the most important ones. The blocks will store the same information in a lighter form, this will allow more transactions to be stored in a block and that means faster validation and shorter waiting times assuming the transaction number stays the same. SegWit also fixes transaction malleability which was one of the largest issues of Bitcoin since the very start. Finally, it allows the implementation of Lightning networks, networks that process transactions offline, off-chain. This will remove some of the heavy transaction load from Bitcoin.
I am a big fan of Bitcoin and I’ve been using it since 2012. I was mining for almost 2 years until my electricity was costing me more than the coins I was producing. I’ve worked in few projects that were accepting Bitcoin as payment, processing the transactions and more. During the life of Bitcoin we have seen few bubbles, meaning the price going up parabolic, a lot faster than the previous periods and eventually crashing back. Every time, the price after the crash was higher than the price the rally was starting. I believe we are now in another bubble, prices doubled in about a month and we see big gains daily. This is unsustainable and eventually all markets with these characteristics are correcting themselves. The only questions no one can answer is how high it will go before the crash and when it will happen. In the long term I believe Bitcoin will worth more than what it is now but be careful when buying Bitcoins now. Why buy now when you can buy in few days or weeks with a discount. There is no doubt that Bitcoin has now far more users and investors and that is why the price is so high (over $2200) but that doesn’t mean it can continue playing the greater fool game forever.
We moved the website from GoDaddy to DreamHost. That move will help us to serve better our visitors since everything will be faster. Dreamhost is using SSD in all its packages, shared hosting, VPS and deticated servers. We chose VPS for our needs and there is option to either add resources or upgrade (almost) without any downtime. In addition we’ve added a SSL certificate to encrypt the communication between the browser and the server. There are more steps for this one since we are planning to force all traffic to be encrypted and go through https for better security and privacy. Once the upgrade is finished, we will start posting more frequently since we couldn’t post during the upgrade. Lastly, we are planning a new release for Ultra PDF Merger to support bookmarks.
I would like to tell you the story from my point of view and then decide if buying Bitcoin now it is a good idea. First of all, for Bitcoin to be able to handle the number of transactions other payment systems do needs to change and this is known since the creation of Bitcoin. From time to time some spam the Bitcoin network with transactions and this leads to two things, first to delay the verification of the transactions and second to increase the transaction fees in order for the transactions to be verified faster. The last spam (days ago) was the worst so far and it created the largest backlog of transactions. I had a transaction that took a week to be confirmed. There are some proposals on how Bitcoin can change and handle larger amount of transactions, the most common are SegWit by Bitcoin core and Bitcoin Unlimited mostly backed by miners. SegWit (Segregated Witness) is a soft fork which means it can handle “old style” transactions along with the new ones and Bitcoin continues normally. Bitcoin Unlimited is had fork which means that it is incompatible and will cause problems in the Bitcoin network. If that happens which is what Bitcoin miners want is to have two Bitcoin blockchains and by extension two coins. Exchange sites decided to keep the Bitcoin core as BTC (or XBT) and the new coin (if created) as BTU (or XBU).