jeudi 5 septembre 2019

Print all hours from 00:00 to 23:59

I would like to print all the hours: minutes in a day from 00:00 to 23:59.

This part goes beyond the question, but if you want to help me, this is the whole idea:

Once that is done, I would like to calculate all the "curious" times that can be interpreted as serendipities. Patterns like: 00:00, 22:22, 01:10, 12:34, 11:44, and the like.

Later on, I would like to count all the "serendipities", and divide them to the total number of hours to know the probabilities of find a "serendipity" each time a person look at the time on his smartphone.

To be honest, I am pretty lost. There is already some months without coding. For the first part of the problem, I guess that a loop can make the task. For the second part, an if conditional can probably make it.

For the first part of the problem I have tried loops like this

for(i in x){
  for(k in y){
    cat(i,":",k, ",")
  }
}

For the second, something like Assuming the digits of the time are ab:cd

if(a==b & a==c & a==d){
print(ab:cd)
TRUE
}

if(a==b & c==d){
print(ab:cd)
TRUE
}

I would like to get the whole list of numbers first. Then, the list of "serendipities", and finally the count of both to make the percentage. I find interesting how people find patterns in numbers when they look at the time, and I would like to know how probable is to get one of these patterns out of the 24*60 = 1440 I hope I have explained myself. (I used to be better with coding and maths, but after some months, I have forgotten almost everything).

Many thanks for your help!!

Aucun commentaire:

Enregistrer un commentaire