For this table:
(edit: the odd values in the table are highlighted green. In column8 the value 27 should also be highlighted green)
Using the spreadsheet axes the 8 columns are C:J (8 columns) and the 14 rows are 27:40 (14 rows).
In column1: there are two odd numbers, 3 and 1. I would like to select the odd numbers in column z given:
The odd numbers have an interval of 8 rows for each column. So the odd numbers occur every 8 rows on each column.
Each column has a row offset for the odd numbers from the previous columns odd numbers.
Column1 positions of the odd numbers is known, and can be used to calculate the positions of odd numbers for the other columns. ie column1 at row 11 value is 1.
If the row index is incremented the table value decreases by r=0.25==1/w where w=4. If the column index is incremented the table value increase by 3.75==r*y where r=0.25 and y=15.
For column z=1 the odd numbers are {1,3}.
For each of the odd numbers in column z, check if excel column A (bitmask) is 1.
I would like to replace the code I'm currently using to do this to be more efficient:
possibleCoprimesList1 = {};
possibleCoprimesListEven1 = {};
possibleCoprimesListOdd1 = {};
For[i = 1, i <= Length[A309497distinctValuesSorted], i++,
solveForThisX = A309497distinctValuesSorted[[i]];
nthTotative = ((A060753*nthTotativeToFind) - solveForThisX)/A038110 ;
If[IntegerQ[nthTotative] == True &&
OddQ[nthTotative] && ! Divisible[nthTotative, 5],
AppendTo[possibleCoprimesList1, nthTotative];
If[EvenQ[nthTotativeToFind] && EvenQ[solveForThisX],
AppendTo[possibleCoprimesListEven1, nthTotative]
];
If[OddQ[nthTotativeToFind] && OddQ[solveForThisX],
AppendTo[possibleCoprimesListOdd1, nthTotative]
]
]
]
The full code I am using:
row[n_] := -(v =
Numerator[Product[1 - 1/Prime[i], {i, 1, n}]/Prime[n]]*
Select[Range[(p = Product[Prime[i], {i, 1, n}])],
CoprimeQ[p, #] &]) +
Denominator[Product[((pr = Prime[i]) - 1)/pr, {i, 1, n}]]*
Range[Length[v]];
nToCheck = 3
Print["find the nth totative"]
nthTotativeToFind = 1
A286941 =
Table[Function[P, Select[Range@P, CoprimeQ[#, P] &]]@
Product[Prime@i, {i, n}], {n, nToCheck}];
A286941row = A286941[[nToCheck]];
Print["totatives in A286941 row"]
Length[A286941row]
A309497row = row[nToCheck];
A038110list = {1, 1, 4, 8, 16, 192, 3072, 55296, 110592, 442368,
13271040, 477757440};
A038110 = A038110list[[nToCheck]];
A060753list = {2, 3, 15, 35, 77, 1001, 17017, 323323, 676039, 2800733,
86822723, 3212440751};
A060753 = A060753list[[nToCheck]];
A161527list = {2, 11, 27, 61, 809, 13945, 268027, 565447, 2358365,
73551683, 2734683311, 112599773191, 4860900544813};
A161527 = A161527list[[nToCheck]];
A309497firstValue = A161527;
Print["Min A309497"]
Min[A309497row]
Print["Max A309497"]
Max[A309497row]
Print["A309497distinctRange1"]
A309497distinctRange1 = Range[Min[A309497row], Max[A309497row]];
Length[A309497distinctRange1]
Print["max minus min plus 1"]
maxMinusMinPlus1 = (Max[A309497row] - Min[A309497row]) + 1
DeleteDuplicates[A309497row];
A309497distinctValuesSorted = Sort[DeleteDuplicates[A309497row]];
Length[A309497row];
Print["distinct A309497 values"]
distinctValuesCount = Length[DeleteDuplicates[A309497row]]
Print["A038110"]
A038110
Print["A060753"]
A060753
possibleCoprimesList1 = {};
possibleCoprimesListEven1 = {};
possibleCoprimesListOdd1 = {};
For[i = 1, i <= Length[A309497distinctValuesSorted], i++,
solveForThisX = A309497distinctValuesSorted[[i]];
nthTotative = ((A060753*nthTotativeToFind) - solveForThisX)/A038110 ;
If[IntegerQ[nthTotative] == True &&
OddQ[nthTotative] && ! Divisible[nthTotative, 5],
AppendTo[possibleCoprimesList1, nthTotative];
If[EvenQ[nthTotativeToFind] && EvenQ[solveForThisX],
AppendTo[possibleCoprimesListEven1, nthTotative]
];
If[OddQ[nthTotativeToFind] && OddQ[solveForThisX],
AppendTo[possibleCoprimesListOdd1, nthTotative]
]
]
]
Print["possibleCoprimesList1"]
Sort[possibleCoprimesList1]
Print["list length"]
Length[possibleCoprimesList1]
Print["Actual coprime"]
A286941row[[nthTotativeToFind]]
Print["nth prime for comparison"]
Prime[nthTotativeToFind]
Print["possibleCoprimesList1 contains actual coprime"]
MemberQ[possibleCoprimesList1, A286941row[[nthTotativeToFind]]]
```