diff --git a/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html b/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html index f57fecb10..b60a65feb 100644 --- a/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html +++ b/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html @@ -155,11 +155,11 @@ Functions

Main function.

Returns
0 on exit
-
100 {
-
101 test(); // run self-test implementations
-
102 return 0;
-
103}
-
static void test()
Self-test implementations.
Definition next_higher_number_with_same_number_of_set_bits.cpp:76
+
97 {
+
98 test(); // run self-test implementations
+
99 return 0;
+
100}
+
static void test()
Self-test implementations.
Definition next_higher_number_with_same_number_of_set_bits.cpp:73
Here is the call graph for this function:
@@ -193,29 +193,29 @@ Here is the call graph for this function:

Self-test implementations.

Returns
void
-
76 {
-
77 // x = 4 return 8
- -
79 // x = 6 return 9
- -
81 // x = 13 return 14
- -
83 // x = 64 return 128
-
84 assert(bit_manipulation::next_higher_number(64) == 128);
-
85 // x = 15 return 23
- -
87 // x= 32 return 64
- -
89 // x = 97 return 98
- -
91 // x = 1024 return 2048
-
92 assert(bit_manipulation::next_higher_number(1024) == 2048);
-
93
-
94 std::cout << "All test cases have successfully passed!" << std::endl;
-
95}
+
73 {
+
74 // x = 4 return 8
+ +
76 // x = 6 return 9
+ +
78 // x = 13 return 14
+ +
80 // x = 64 return 128
+
81 assert(bit_manipulation::next_higher_number(64) == 128);
+
82 // x = 15 return 23
+ +
84 // x= 32 return 64
+ +
86 // x = 97 return 98
+ +
88 // x = 1024 return 2048
+
89 assert(bit_manipulation::next_higher_number(1024) == 2048);
+
90
+
91 std::cout << "All test cases have successfully passed!" << std::endl;
+
92}
T endl(T... args)
-
uint64_t next_higher_number(uint64_t x)
The main function implements checking the next number.
Definition next_higher_number_with_same_number_of_set_bits.cpp:31
+
uint64_t next_higher_number(uint64_t x)
The main function implements checking the next number.
Definition next_higher_number_with_same_number_of_set_bits.cpp:32
Here is the call graph for this function:
diff --git a/d5/df6/check__amicable__pair_8cpp.html b/d5/df6/check__amicable__pair_8cpp.html index 777ac8383..dc800f9f4 100644 --- a/d5/df6/check__amicable__pair_8cpp.html +++ b/d5/df6/check__amicable__pair_8cpp.html @@ -98,12 +98,13 @@ $(document).ready(function(){initNavTree('d5/df6/check__amicable__pair_8cpp.html
check_amicable_pair.cpp File Reference
-

A C++ Program to check whether a pair of number is amicable pair or not. +

A C++ Program to check whether a pair of numbers is an amicable pair or not. More...

#include <cassert>
#include <iostream>
@@ -113,68 +114,33 @@ Include dependency graph for check_amicable_pair.cpp:
+ + + + +

+Namespaces

namespace  math
 for IO operations
 
- - - - - - + + + + + + + + + +

Functions

int sum_of_divisor (int num)
 
bool are_amicable (int x, int y)
 
void test ()
 
int math::sum_of_divisor (int num)
 Function to calculate the sum of all the proper divisor of an integer.
 
bool math::are_amicable (int x, int y)
 Function to check whether the pair is amicable or not.
 
static void tests ()
 Self-test implementations.
 
int main ()
 Main function.
 

Detailed Description

-

A C++ Program to check whether a pair of number is amicable pair or not.

-

Amicable Pair are two positive integers such that sum of the proper divisor of each number is equal to the other number.

Author
iamnambiar
+

A C++ Program to check whether a pair of numbers is an amicable pair or not.

+

An Amicable Pair is two positive integers such that the sum of the proper divisor for each number is equal to the other number.

+
Note
Remember that a proper divisor is any positive whole number that divides into a selected number, apart from the selected number itself, and returns a positive integer. for example 1, 2 and 5 are all proper divisors of 10.
+
Author
iamnambiar

Function Documentation

- -

◆ are_amicable()

- -
-
- - - - - - - - - - - - - - - - - - -
bool are_amicable (int x,
int y 
)
-
-

Function to check whether the pair is amicable or not.

Parameters
- - - -
xFirst number.
ySecond number.
-
-
-
Returns
true if the pair is amicable
-
-false if the pair is not amicable
-
48 {
-
49 return (sum_of_divisor(x) == y) && (sum_of_divisor(y) == x);
-
50}
-
int sum_of_divisor(int num)
Definition check_amicable_pair.cpp:21
-
-Here is the call graph for this function:
-
-
-
- -
-

◆ main()

@@ -190,97 +156,63 @@ Here is the call graph for this function:
-

Main Function

-
68 {
-
69 test();
-
70 std::cout << "Assertion Success." << std::endl;
-
71 return 0;
-
72}
- -
void test()
Definition check_amicable_pair.cpp:56
-
T endl(T... args)
+ +

Main function.

+
Returns
0 on exit
+
81 {
+
82 tests(); // perform self-tests implementations
+
83 return 0;
+
84}
+
static void tests()
Self-test implementations.
Definition check_amicable_pair.cpp:67
Here is the call graph for this function:
-
+
- -

◆ sum_of_divisor()

+ +

◆ tests()

+ + + + + +
- - - - - - -
int sum_of_divisor (int num)
-
-

Function to calculate the sum of all the proper divisor of an integer.

Parameters
- - -
numFirst number.
-
-
-
Returns
Sum of the proper divisor of the number.
-
21 {
-
22 // Variable to store the sum of all proper divisors.
-
23 int sum = 0;
-
24 // Below loop condition helps to reduce Time complexity by a factor of
-
25 // square root of the number.
-
26 for (int div = 2; div * div <= num; ++div) {
-
27 // Check 'div' is divisor of 'num'.
-
28 if (num % div == 0) {
-
29 // If both divisor are same, add once to 'sum'
-
30 if (div == (num / div)) {
-
31 sum += div;
-
32 } else {
-
33 // If both divisor are not the same, add both to 'sum'.
-
34 sum += (div + (num / div));
-
35 }
-
36 }
-
37 }
-
38 return sum + 1;
-
39}
-
T div(T... args)
-
T sum(const std::vector< std::valarray< T > > &A)
Definition vector_ops.hpp:232
-
-
- - -

◆ test()

- -
-
- - - +
void test static void tests ( )
+
+static
-

Function for testing the is_amicable() with all the test cases.

-
56 {
-
57 // are_amicable(220, 284) returns true.
-
58 assert(are_amicable(220, 284) == true);
-
59 // are_amicable(6232, 6368) returns true.
-
60 assert(are_amicable(6368, 6232) == true);
-
61 // are_amicable(458, 232) returns false.
-
62 assert(are_amicable(458, 232) == false);
-
63}
-
bool are_amicable(int x, int y)
Definition check_amicable_pair.cpp:48
+ +

Self-test implementations.

+
Returns
void
+
67 {
+
68 assert(math::are_amicable(220, 284) == true);
+
69 assert(math::are_amicable(6368, 6232) == true);
+
70 assert(math::are_amicable(458, 232) == false);
+
71 assert(math::are_amicable(17296, 18416) == true);
+
72 assert(math::are_amicable(18416, 17296) == true);
+
73
+
74 std::cout << "All tests have successfully passed!" << std::endl;
+
75}
+ +
T endl(T... args)
+
bool are_amicable(int x, int y)
Function to check whether the pair is amicable or not.
Definition check_amicable_pair.cpp:58
Here is the call graph for this function:
-
+
diff --git a/d5/df6/check__amicable__pair_8cpp.js b/d5/df6/check__amicable__pair_8cpp.js index 2e54a5abb..37d01afee 100644 --- a/d5/df6/check__amicable__pair_8cpp.js +++ b/d5/df6/check__amicable__pair_8cpp.js @@ -1,7 +1,7 @@ var check__amicable__pair_8cpp = [ - [ "are_amicable", "d5/df6/check__amicable__pair_8cpp.html#afeb67e204ec7de02ad152c11df4d1e01", null ], + [ "are_amicable", "d5/df6/check__amicable__pair_8cpp.html#a8e6eede206201db0d1dbb618fa969bec", null ], [ "main", "d5/df6/check__amicable__pair_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], - [ "sum_of_divisor", "d5/df6/check__amicable__pair_8cpp.html#ac656a51b4c3bd7d63b7dcc75dc3e5576", null ], - [ "test", "d5/df6/check__amicable__pair_8cpp.html#ae1a3968e7947464bee7714f6d43b7002", null ] + [ "sum_of_divisor", "d5/df6/check__amicable__pair_8cpp.html#af05567415a9ea36c254b54e3d5a2152a", null ], + [ "tests", "d5/df6/check__amicable__pair_8cpp.html#a483bb8ccf42aaf7375a83e91490eda1e", null ] ]; \ No newline at end of file diff --git a/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map b/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map new file mode 100644 index 000000000..c23161b1c --- /dev/null +++ b/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 b/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 new file mode 100644 index 000000000..238f4e4b3 --- /dev/null +++ b/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.md5 @@ -0,0 +1 @@ +91b553d09597618c6169583635e22eff \ No newline at end of file diff --git a/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg b/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg new file mode 100644 index 000000000..9becd2b80 --- /dev/null +++ b/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + +tests + + +Node1 + + +tests + + + + + +Node2 + + +math::are_amicable + + + + + +Node1->Node2 + + + + + + + + +Node4 + + +std::endl + + + + + +Node1->Node4 + + + + + + + + +Node3 + + +math::sum_of_divisor + + + + + +Node2->Node3 + + + + + + + + + + + + + diff --git a/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph_org.svg b/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph_org.svg new file mode 100644 index 000000000..e3bf13cea --- /dev/null +++ b/d5/df6/check__amicable__pair_8cpp_a483bb8ccf42aaf7375a83e91490eda1e_cgraph_org.svg @@ -0,0 +1,75 @@ + + + + + + +tests + + +Node1 + + +tests + + + + + +Node2 + + +math::are_amicable + + + + + +Node1->Node2 + + + + + + + + +Node4 + + +std::endl + + + + + +Node1->Node4 + + + + + + + + +Node3 + + +math::sum_of_divisor + + + + + +Node2->Node3 + + + + + + + + diff --git a/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map b/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map deleted file mode 100644 index 87fa0f681..000000000 --- a/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.map +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 b/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 deleted file mode 100644 index 67cbd0ca1..000000000 --- a/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.md5 +++ /dev/null @@ -1 +0,0 @@ -a5c5224b33c1ee0eca843294cfe7bf39 \ No newline at end of file diff --git a/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg b/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg deleted file mode 100644 index 2d0a08945..000000000 --- a/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph.svg +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - -test - - -Node1 - - -test - - - - - -Node2 - - -are_amicable - - - - - -Node1->Node2 - - - - - - - - -Node3 - - -sum_of_divisor - - - - - -Node2->Node3 - - - - - - - - - - - - - diff --git a/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg b/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg deleted file mode 100644 index 9b4c11080..000000000 --- a/d5/df6/check__amicable__pair_8cpp_ae1a3968e7947464bee7714f6d43b7002_cgraph_org.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - -test - - -Node1 - - -test - - - - - -Node2 - - -are_amicable - - - - - -Node1->Node2 - - - - - - - - -Node3 - - -sum_of_divisor - - - - - -Node2->Node3 - - - - - - - - diff --git a/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index 9b0bb13e8..d044c0196 100644 --- a/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + diff --git a/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 index 823c5d3ed..b62d41ae1 100644 --- a/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ b/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -1 +1 @@ -d4a61131aa5e64aef2a6e6062cf89df1 \ No newline at end of file +d20519596209338efb9b7411bd2f01be \ No newline at end of file diff --git a/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index 8d72b0335..fb281ff6e 100644 --- a/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/d5/df6/check__amicable__pair_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -4,8 +4,8 @@ - +