easy solution
Intuition\nWe need to find an integer ans[i] such that the bitwise OR of ans[i] and ans[i] + 1 is equal to nums[i] for each prime number in the input array nums
# Intuition\nWe need to find an integer `ans[i]` such that the bitwise OR of `ans[i]` and `ans[i] + 1` is equal to `nums[i]` for each prime number in the input array `nums`. The challenge is to minimize the value of `ans[i]` while ensuring this condition holds. If no such value of `ans[i]` exists, we return `-1`.\n\n# Approach\n1. For each element `nums[i]`, we iterate over possible values of `ans[i]`, checking if the condition `(ans[i] OR (ans[i] + 1)) == nums[i]` is satisfied.\n2. Start from 0 and go up to `nums[i]` because we want to minimize `ans[i]`. If we find such a value, we use it; otherwise, we return `-1` for that index.\n3. Store the results in an array `ans` and return it.\n\n# Complexity\n- **Time complexity**:  \n  $$O(n^2)$$ where $$n$$ is the size of the input array. For each element, we loop through all possible values up to `nums[i]`.\n  \n- **Space complexity**:  \n  $$O(n)$$, which is the space needed to store the result array `ans`.\n\n# Code\n```cpp\nclass Solution {\npublic:\n    int findOR(int n) {\n        for (int i = 0; i <= n; i++) {\n            if ((i | (i + 1)) == n) return i;\n        }\n        return -1;\n    }\n\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        vector<int> ans(nums.size());\n        for (int i = 0; i < nums.size(); i++) {\n            ans[i] = findOR(nums[i]);\n        }\n        return ans;\n    }\n};\n```
['C++']