Group,
Again, self teaching has its limitations.
Below is code that ultimately will answer question 3: design a program that finds all numbers from 1 to 1000 whose prime factors, when added together, sum up to a prime number.
I am starting with a string limit of 1 to 100 to keep it manageable.
I have labeled each unique output with a new name so ultimately I can harvest them. I think a few more iterations will gt me all that I need.
The problem is,in the code below, the output starts at twenty. I do not understand why it does not output starting at least at 4 / 2 = 2.
Can anyone help me?
Thank in advance,
Dan
Code:
#include <iostream>
#include <string>
using namespace std;
int i;
int j;
int k;
int l;
int m;
int main ()
{
// determine what the numbers prime factors are
for ( int i = 2; i < 100; i++)
{
for ( int j = 2; j < i; j++ )
{
if ( i % j == 0 )
{
int k = i / j;
cout << i << " i" << " div " << j << " j" << " = " << k << " k" << "\n";
if ( k % j == 0)
{
int l = j;
int m = k / l;
cout << "\t" << " and " << k << " k" << " div " << l << " lj" << " = " << m << " m" << "\n";
}
}
}
}
}