Is there a code or script to do the math?
It's easier than you might think. In fact, you can use any library that allows you to calculate the public key from a private key and replace the parameters:
# Elliptic curve parameters (secp256k1)
P = 2**256 - 2**32 - 977
N = 115792089237316195423570985008687907852837564279074904382605163141518161494337
#N = 57896044618658097711785492504343953926418782139537452191302581570759080747168 --> here to divide by 2 for example
A = 0
B = 7
Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240 --> here put the key you want to divide
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424 --> same for y coordinate
G = (Gx, Gy)