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 --> original parameter
#N = 57896044618658097711785492504343953926418782139537452191302581570759080747169 --> 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)
So sorta like this:
_p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2FL
_r = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141L
_b = 0x0000000000000000000000000000000000000000000000000000000000000007L
_a = 0x0000000000000000000000000000000000000000000000000000000000000000L
_Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798L
_Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8L
But you do have to have the private key though?