Algorithms
Easy
2778
2844
Sum of Squares of Special Elements 
sum-of-squares-of-special-elements
"""
You are given a 1-indexed integer array nums of length n.

An element nums[i] of nums is called special if i divides n, i.e. n % i == 0.

Return the sum of the squares of all special elements of nums.

Example 1:

Input: nums = [1,2,3,4]
Output: 21
Explanation: There are exactly 3 special elements in nums: nums[1] since 1 divides 4, nums[2] since 2 divides 4, and nums[4] since 4 divides 4.
Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[4] * nums[4] = 1 * 1 + 2 * 2 + 4 * 4 = 21.

Example 2:

Input: nums = [2,7,1,19,18,3]
Output: 63
Explanation: There are exactly 4 special elements in nums: nums[1] since 1 divides 6, nums[2] since 2 divides 6, nums[3] since 3 divides 6, and nums[6] since 6 divides 6.
Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[3] * nums[3] + nums[6] * nums[6] = 2 * 2 + 7 * 7 + 1 * 1 + 3 * 3 = 63.


Constraints:

 * 1 <= nums.length == n <= 50
 * 1 <= nums[i] <= 50
"""
class Solution:
    def sumOfSquares(self, nums: List[int]) -> int:
        
You are given a 1-indexed integer array nums of length n.

An element nums[i] of nums is called special if i divides n, i.e. n % i == 0.

Return the sum of the squares of all special elements of nums.

Example 1:

Input: nums = [1,2,3,4]
Output: 21
Explanation: There are exactly 3 special elements in nums: nums[1] since 1 divides 4, nums[2] since 2 divides 4, and nums[4] since 4 divides 4.
Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[4] * nums[4] = 1 * 1 + 2 * 2 + 4 * 4 = 21.

Example 2:

Input: nums = [2,7,1,19,18,3]
Output: 63
Explanation: There are exactly 4 special elements in nums: nums[1] since 1 divides 6, nums[2] since 2 divides 6, nums[3] since 3 divides 6, and nums[6] since 6 divides 6.
Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[3] * nums[3] + nums[6] * nums[6] = 2 * 2 + 7 * 7 + 1 * 1 + 3 * 3 = 63.


Constraints:

 * 1 <= nums.length == n <= 50
 * 1 <= nums[i] <= 50


Please complete the code below to solve above prblem:
```python
class Solution:
    def sumOfSquares(self, nums: List[int]) -> int:
        
```

my_solution = Solution()

test_input = { "nums": [1,2,3,4] }
assert my_solution.sumOfSquares(**test_input) == 21

test_input = { "nums": [2,7,1,19,18,3] }
assert my_solution.sumOfSquares(**test_input) == 63

test_input = { "nums": [1] }
assert my_solution.sumOfSquares(**test_input) == 1

test_input = { "nums": [2] }
assert my_solution.sumOfSquares(**test_input) == 4

test_input = { "nums": [3] }
assert my_solution.sumOfSquares(**test_input) == 9

test_input = { "nums": [4] }
assert my_solution.sumOfSquares(**test_input) == 16

test_input = { "nums": [5] }
assert my_solution.sumOfSquares(**test_input) == 25

test_input = { "nums": [6] }
assert my_solution.sumOfSquares(**test_input) == 36

test_input = { "nums": [7] }
assert my_solution.sumOfSquares(**test_input) == 49

test_input = { "nums": [8] }
assert my_solution.sumOfSquares(**test_input) == 64

test_input = { "nums": [9] }
assert my_solution.sumOfSquares(**test_input) == 81

test_input = { "nums": [10] }
assert my_solution.sumOfSquares(**test_input) == 100

test_input = { "nums": [11] }
assert my_solution.sumOfSquares(**test_input) == 121

test_input = { "nums": [12] }
assert my_solution.sumOfSquares(**test_input) == 144

test_input = { "nums": [13] }
assert my_solution.sumOfSquares(**test_input) == 169

test_input = { "nums": [14] }
assert my_solution.sumOfSquares(**test_input) == 196

test_input = { "nums": [15] }
assert my_solution.sumOfSquares(**test_input) == 225

test_input = { "nums": [16] }
assert my_solution.sumOfSquares(**test_input) == 256

test_input = { "nums": [17] }
assert my_solution.sumOfSquares(**test_input) == 289

test_input = { "nums": [18] }
assert my_solution.sumOfSquares(**test_input) == 324

test_input = { "nums": [19] }
assert my_solution.sumOfSquares(**test_input) == 361

test_input = { "nums": [20] }
assert my_solution.sumOfSquares(**test_input) == 400

test_input = { "nums": [21] }
assert my_solution.sumOfSquares(**test_input) == 441

test_input = { "nums": [22] }
assert my_solution.sumOfSquares(**test_input) == 484

test_input = { "nums": [23] }
assert my_solution.sumOfSquares(**test_input) == 529

test_input = { "nums": [24] }
assert my_solution.sumOfSquares(**test_input) == 576

test_input = { "nums": [25] }
assert my_solution.sumOfSquares(**test_input) == 625

test_input = { "nums": [26] }
assert my_solution.sumOfSquares(**test_input) == 676

test_input = { "nums": [27] }
assert my_solution.sumOfSquares(**test_input) == 729

test_input = { "nums": [28] }
assert my_solution.sumOfSquares(**test_input) == 784

test_input = { "nums": [29] }
assert my_solution.sumOfSquares(**test_input) == 841

test_input = { "nums": [30] }
assert my_solution.sumOfSquares(**test_input) == 900

test_input = { "nums": [31] }
assert my_solution.sumOfSquares(**test_input) == 961

test_input = { "nums": [32] }
assert my_solution.sumOfSquares(**test_input) == 1024

test_input = { "nums": [33] }
assert my_solution.sumOfSquares(**test_input) == 1089

test_input = { "nums": [34] }
assert my_solution.sumOfSquares(**test_input) == 1156

test_input = { "nums": [35] }
assert my_solution.sumOfSquares(**test_input) == 1225

test_input = { "nums": [36] }
assert my_solution.sumOfSquares(**test_input) == 1296

test_input = { "nums": [37] }
assert my_solution.sumOfSquares(**test_input) == 1369

test_input = { "nums": [38] }
assert my_solution.sumOfSquares(**test_input) == 1444

test_input = { "nums": [39] }
assert my_solution.sumOfSquares(**test_input) == 1521

test_input = { "nums": [40] }
assert my_solution.sumOfSquares(**test_input) == 1600

test_input = { "nums": [41] }
assert my_solution.sumOfSquares(**test_input) == 1681

test_input = { "nums": [42] }
assert my_solution.sumOfSquares(**test_input) == 1764

test_input = { "nums": [43] }
assert my_solution.sumOfSquares(**test_input) == 1849

test_input = { "nums": [44] }
assert my_solution.sumOfSquares(**test_input) == 1936

test_input = { "nums": [45] }
assert my_solution.sumOfSquares(**test_input) == 2025

test_input = { "nums": [46] }
assert my_solution.sumOfSquares(**test_input) == 2116

test_input = { "nums": [47] }
assert my_solution.sumOfSquares(**test_input) == 2209

test_input = { "nums": [48] }
assert my_solution.sumOfSquares(**test_input) == 2304

test_input = { "nums": [49] }
assert my_solution.sumOfSquares(**test_input) == 2401

test_input = { "nums": [50] }
assert my_solution.sumOfSquares(**test_input) == 2500

test_input = { "nums": [16,16] }
assert my_solution.sumOfSquares(**test_input) == 512

test_input = { "nums": [13,36] }
assert my_solution.sumOfSquares(**test_input) == 1465

test_input = { "nums": [40,37] }
assert my_solution.sumOfSquares(**test_input) == 2969

test_input = { "nums": [33,42] }
assert my_solution.sumOfSquares(**test_input) == 2853

test_input = { "nums": [46,9] }
assert my_solution.sumOfSquares(**test_input) == 2197

test_input = { "nums": [30,14] }
assert my_solution.sumOfSquares(**test_input) == 1096

test_input = { "nums": [5,41] }
assert my_solution.sumOfSquares(**test_input) == 1706

test_input = { "nums": [17,9] }
assert my_solution.sumOfSquares(**test_input) == 370

test_input = { "nums": [29,21] }
assert my_solution.sumOfSquares(**test_input) == 1282

test_input = { "nums": [4,38] }
assert my_solution.sumOfSquares(**test_input) == 1460

test_input = { "nums": [14,18] }
assert my_solution.sumOfSquares(**test_input) == 520

test_input = { "nums": [11,7] }
assert my_solution.sumOfSquares(**test_input) == 170

test_input = { "nums": [11,36] }
assert my_solution.sumOfSquares(**test_input) == 1417

test_input = { "nums": [18,26] }
assert my_solution.sumOfSquares(**test_input) == 1000

test_input = { "nums": [37,46] }
assert my_solution.sumOfSquares(**test_input) == 3485

test_input = { "nums": [13,33] }
assert my_solution.sumOfSquares(**test_input) == 1258

test_input = { "nums": [39,1] }
assert my_solution.sumOfSquares(**test_input) == 1522

test_input = { "nums": [37,16] }
assert my_solution.sumOfSquares(**test_input) == 1625

test_input = { "nums": [22,34] }
assert my_solution.sumOfSquares(**test_input) == 1640

test_input = { "nums": [4,50] }
assert my_solution.sumOfSquares(**test_input) == 2516

test_input = { "nums": [42,40] }
assert my_solution.sumOfSquares(**test_input) == 3364

test_input = { "nums": [7,44] }
assert my_solution.sumOfSquares(**test_input) == 1985

test_input = { "nums": [21,27] }
assert my_solution.sumOfSquares(**test_input) == 1170

test_input = { "nums": [49,35] }
assert my_solution.sumOfSquares(**test_input) == 3626

test_input = { "nums": [32,20] }
assert my_solution.sumOfSquares(**test_input) == 1424

test_input = { "nums": [30,12] }
assert my_solution.sumOfSquares(**test_input) == 1044

test_input = { "nums": [50,42] }
assert my_solution.sumOfSquares(**test_input) == 4264

test_input = { "nums": [3,11] }
assert my_solution.sumOfSquares(**test_input) == 130

test_input = { "nums": [38,17] }
assert my_solution.sumOfSquares(**test_input) == 1733

test_input = { "nums": [50,32] }
assert my_solution.sumOfSquares(**test_input) == 3524

test_input = { "nums": [12,35] }
assert my_solution.sumOfSquares(**test_input) == 1369

test_input = { "nums": [9,32] }
assert my_solution.sumOfSquares(**test_input) == 1105

test_input = { "nums": [6,11] }
assert my_solution.sumOfSquares(**test_input) == 157

test_input = { "nums": [11,39] }
assert my_solution.sumOfSquares(**test_input) == 1642

test_input = { "nums": [18,29] }
assert my_solution.sumOfSquares(**test_input) == 1165

test_input = { "nums": [44,29] }
assert my_solution.sumOfSquares(**test_input) == 2777

test_input = { "nums": [50,13] }
assert my_solution.sumOfSquares(**test_input) == 2669

test_input = { "nums": [46,46] }
assert my_solution.sumOfSquares(**test_input) == 4232

test_input = { "nums": [27,5] }
assert my_solution.sumOfSquares(**test_input) == 754

test_input = { "nums": [12,13] }
assert my_solution.sumOfSquares(**test_input) == 313

test_input = { "nums": [10,46] }
assert my_solution.sumOfSquares(**test_input) == 2216

test_input = { "nums": [37,32] }
assert my_solution.sumOfSquares(**test_input) == 2393

test_input = { "nums": [26,33] }
assert my_solution.sumOfSquares(**test_input) == 1765

test_input = { "nums": [44,3] }
assert my_solution.sumOfSquares(**test_input) == 1945

test_input = { "nums": [9,16] }
assert my_solution.sumOfSquares(**test_input) == 337

test_input = { "nums": [7,21] }
assert my_solution.sumOfSquares(**test_input) == 490

test_input = { "nums": [23,33] }
assert my_solution.sumOfSquares(**test_input) == 1618

test_input = { "nums": [22,5] }
assert my_solution.sumOfSquares(**test_input) == 509