Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Input: 3 Output: 2, -2
- Input: 10 Output: 8, 4
- Input: 50 Output: 48, 35
- Input: 1000 Output: 1000, 971
- Input: 9999 Output: 9984, 9802
- Num PrimeFacs PrimeFacs^2 SumPrimeFacs^2 Result
- 2 [2] [4] 4 -2
- 3 [3] [9] 9 -6
- 4 [2] [4] 4 0
- 5 [5] [25] 25 -20
- 6 [2, 3] [4, 9] 13 -7
- 7 [7] [49] 49 -42
- 8 [2] [4] 4 4
- 9 [3] [9] 9 0
- 10 [2, 5] [4, 25] 29 -19
- u2x;`;y;*@-`M;M;)@í@E
- u2x;`;y;*@-`M;M;)@í@E
- u2x; push two copies of range(2, n+1) ([2, n])
- ` `M map:
- ; duplicate
- y; push two copies of prime divisors
- * dot product of prime divisors lists (equivalent to sum of squares)
- @- subtract from n
- ;M;) duplicate, two copies of max, move one copy to bottom of stack
- @í get index of max element
- @E get corresponding element from range
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement