Then I spent way too long on this fun code:
//finds Unix time (number of seconds since 1970)
//factors this number
//creates a string to be pasted into a LaTeX document
//sends this string to a file
//code proudly written by Rose DiFonzo, 2017, but you may steal if you would like
#include <iostream>
#include <time.h>
#include <cmath>
#include <cstdlib>
#include <cstdint>
#include <fstream>
bool primep (long int N)
{
for (int m=2; m<= floor(sqrt (N)); m++)
{
if (N%m ==0) return false;
}
return 1;
}
int main()
{
using namespace std;
int64_t divisorlist[1000];
int64_t primedivisorlist[100][3];
int counter (1);
time_t timer;
timer =time (NULL);
cout<<ctime(&timer);
//find alliquot divisors
for (int m=1; m<= floor(sqrt(timer));m++ )
{
if (timer%m == 0)
{divisorlist[counter]=m;
counter++;}
}
//identify repeats
for(int m=counter-1;m> 0;m--)
{
int64_t quotient = timer/divisorlist[m];
if (divisorlist[m] != quotient)
{divisorlist[counter]=quotient;
counter++;
}}
// now extract primes
int bar=1;
for(int m =2; m<=counter-1;m++)
{
if (primep(divisorlist[m]))
{primedivisorlist[bar][1]=divisorlist[m];
bar++;}
}
// now find powers of primes
for (int m=1; m<=bar-1; m++)
{
int power=1;
int64_t x = round(pow(primedivisorlist[m][1], power));
while (timer % x ==0
&& x<=timer)
{
power++;
x = round(pow(primedivisorlist[m][1], power));
}
primedivisorlist[m][2]=power-1;
}
ofstream outf("C:/Users/blah/blah/blahblah.txt");
outf<<ctime(&timer)<<". Or $"<<timer<<" = ";
for(int m =1; m<=bar-1;m++)
{
outf<<primedivisorlist[m][1];
if (primedivisorlist[m][2]>1 )
outf<< "^"<< primedivisorlist[m][2];
if (m<bar-1) outf<<"*";
}
outf<<"$ seconds Unix time.";
outf.close();
}
Actually, I approve of absolutely standard date forms. It is just too bad that the factored number of seconds since the start of the year 1970 is not it.