The magnitude of the field B inside a long solenoid carrying a current
I is
B = m0nI
where n is the number of turns per unit length where N is the total number of turns and r is the average radius 9 Parallel currents attract and anti-parallel currents repel