Skip to main content
techie summer

the summer season has started, and what a great way to enjoy it than to start hacking (or coding, for the misinformed) on old projects, and new ones as well...

however, to the un-tech savvy people reading this blog, i'm sorry but i would have to get a little technical. first of, i'd like to start with a snippet of code, which i hope would be helpful to you and your endeavors.


#include <math.h>

int isprime(int n) {
int prime=1; /* assume that the number is prime */
int dlimit, dit;

if (n <= 3) /* the first 3 primes */
return prime;

if (!(n % 2)) /* if divisible by 2 (or even) */
prime = 0; /* it's not prime */

dlimit = (int) sqrt ( (double) n); /* result of sqrt is a double */

for (dit = 5; (dit <= dlimit) && (prime); dit+=2)
if (!(n % dit)) /* if divisible by odd numbers */
prime = 0; /* then it's not prime */

return prime;
}


this (as you might notice in the near future) will check whether a number is prime. in my estimation, the running time of this algorithm is O(n^1/2) or [oh of square root of n] where n is the number to be checked for primality.

i came up with this and a few more useful code snippets while i was thinking about and checking on my coding abilities the past few days.

now, i will need to brush up on my programming skills because i think i'm way behind of the pack, and knowing how to code is something, and writing code that actually works is another. i have to got both, but still more work is required. anyway, i hope i have time to do what i love most to do, which is think.

chill! =)

Comments

Popular posts from this blog

From FOMO to JOMO

Until very recently I believed that I needed to be on top of the latest news and happenings not only in my field (computer science and software engineering) but also in as many things as I can be on top of. This meant subscribing to all sorts of magazines, newsletters, YouTube channels, Twitch streamers, watching TV and live sport events, etc. — I was on top of a lot of the latest happenings, trends, news, interesting developments. I was having fun and I felt busy. What I did not feel was particularly effective nor productive. I felt like I was consuming so much information with the thought that it might be useful someday. When I was younger this wouldn’t have been an issue but I realised that ever since I’ve started taking stock of what I’ve been spending my time on, that a lot of it I’ve been spending just staying on top of things that I really didn’t need to be on top of. This article is about some of the realisations I’ve made in the course of exploring this issue of “FOMO” or th…

A Passion Project

I was so moved today by the prospect of a passion project that I took some time on a Friday night to get it done. Let me present the #RedJeans project over at redjeans.org. I've found myself wanting to work on a project that came purely from the heart and one that was very dear to me, something that is personal, and connects with a larger community of people in the world.
The idea for redjeans.org came to me as a hint when I was writing up my reflection for 2018. I realised that I didn't spend quite as much time identifying with and working with a community. I did a bit of soul-searching and found that one of the activities I really enjoyed and cherished in years past is donating blood -- and I keep wondering why not more people do it. It was an idle thought but then a conversation with someone where I described why I wrote down "donate blood more often" in 2019 became an idea where instead of just me doing it, how about if I get my friends to do it too?

I left it a…

Futures and Options I: My Introduction to Computing

I've recently been thinking about how my decisions early in life have done me good to put me where I'm at right now. I've certainly lived a very fortunate life -- been blessed with so many good things and been down-right lucky being at the right place at the right time. My 30 year journey to where I am now has been very interesting. I can pretty much say that the experiences I've had up to this point have very much contributed to making me who I am -- and that I regret nothing. Still though I keep thinking about what my life would be like if I hadn't made certain choices I did make throughout the years. There are a few choices I've made that I've stuck to and I keep thinking about wondering "what if I made a different choice instead" -- and the more I think about it, the more I'm happy about the decisions I've made.

Note: This is Part 1 of a series about my early choices in life which have gotten me to where I am today. If you're intere…