Well, I am trying to write a clever code that looks for a 10-base number $n$ such that:
- The digit sum of $n$ in base $2$ must be equal to $k$;
- The GCD of the $n$ in base $2$ and the integer reverse of the number $n$ in base $2$ must be equal to $k$.
I already proved that the number $k$ must end with a $1,3,7$ or $9$. Otherwise, there is no solution possible for $n$. That sequence can be found using the following Mathematica-code:
In[1]=Map[(1/2*(5*# + Mod[3*# + 2, 4] - 4)) &, Range[25]]
Out[1]={1, 3, 7, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 37, 39, 41, 43, 47, 49, 51, 53, 57, 59, 61}
Question: how can I find the minimal value of $n$ such that it obeys the rules stated above?
My work: the rules from above can be written as Mathematica-code as follows:
k==Total[IntegerDigits[n,2]]
k==GCD[FromDigits[IntegerDigits[n,2]],IntegerReverse[FromDigits[IntegerDigits[n,2]]]]
And I know the following solutions $\left(k,n\right)$:
$$\left(k,n\right)\in\left\{\left(1,1\right),\left(3,11\right),\left(9,767\right),\left(11,4543829\right),\left(17,1041919\right),\left(19,4120511\right)\right\}\tag1$$
But I am especially interested in $k=39$ and $k=41$.
I tried running the following code:
In[2]:=Clear["Global`*"];
DeleteCases[ParallelTable[
First[ParallelTable[
If[k == Total[IntegerDigits[n, 2]] &&
k == GCD[FromDigits[IntegerDigits[n, 2]],
IntegerReverse[FromDigits[IntegerDigits[n, 2]]]], {k, n},
Nothing], {n, 0, 10^7}] //. {} -> Nothing] // Quiet, {k,
Map[(1/2*(5*# + Mod[3*# + 2, 4] - 4)) &, Range[25]]}],
First[Nothing]] // Quiet
Out[2]={{1, 1}, {3, 11}, {9, 767}, {11, 4543829}, {17, 1041919}, {19,
4120511}}
But it gave limited solutions and not the one I am especially interested in.