-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsquaredDigitSum.cpp
More file actions
47 lines (39 loc) · 1.05 KB
/
squaredDigitSum.cpp
File metadata and controls
47 lines (39 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @file squareDigitSum.cpp
* @brief Receives initial term via argv[1] and iterates until desired term argv[2], mathematically optimized.
* @author Pedro Henrique Pinto de Oliveira
* @date 2024-05-18
*/
/* Inclusions */
#include "headers/errors.h"
#include <iostream>
#include <string>
using namespace std;
/* Constants */
/* Types */
/* Functions */
void squareDigitSum(int init, int target)
{
for(int i = init; i < target; i++)
{
int squares_sum = 0;
int temp = target;
while(temp > 0)
{
int digit = temp % 10;
squares_sum += digit * digit;
temp /= 10;
}
// Implement a stack buffer which, if (i-init) % 8 == 0, will check if the last element belongs in the sequence, given that this sequence is continuous.
}
}
int main(int argc, char ** argv)
{
const char * str =
R"(+-> 4 -> 16 -> 37 -> 58 ---+
| |
| |
+- 20 <- 42 <- 145 <- 89 <-+)";
cout << "REACHED\n" << str << "\n";
return SUCCESS;
}