Context
Let me start by saying that I did this many years ago so I don't remember how I got there.
I was reviewing some old notes I wrote in August $2017$ in which I had written this algorithm to calculate the divisibility criterion of a generic prime number.
My work
I wrote this:
A number is divisible by a prime number $n$ if the sum/difference of the prenumber $p$ and $k$ times the units digit $u$ is a multiple of $n$
The prenumber is the number without the unit: (the prenumber of $1028$ is $102$)
$$\begin{array}{|c|c|c|c|c|c|}\hline n&p+k u&p-k u&n&p+k u&p-k u\\\hline 7&p+5u&p-2u&47&p+33u&p-14u\\\hline 11&p+10u&p-u&53&p+16u&p-37u\\\hline 13&p+4u&p-9u&59&p+6u&p-53u\\\hline 17&p+12u&p-5u&61&p+55u&p-6u\\\hline 19&p+2u&p-17u&67&p+47u&p-20u\\\hline 23&p+7u&p-16u&71&p+64u&p-7u\\\hline 29&p+3u&p-26u&73&p+22u&p-51u\\\hline 31&p+28u&p-3u&79&p+8u&p-71u\\\hline 37&p+26u&p-11u&83&p+25u&p-58u\\\hline 41&p+37u&p-4u&89&p+9u&p-80u\\\hline 43&p+13u&p-30u&97&p+68u&p-29u\\\hline \end{array}$$ Where $k$ it is calculated based on the units $u$: $$k=\begin{cases}9p+1\ \wedge\ -p&\text{if }u=1\\3p+1\ \wedge\ -7p-2&\text{if }u=3\\7p+5\ \wedge\ -3p-2&\text{if }u=7\\\ \ p+1\ \wedge\ -9p-8&\text{if }u=9\end{cases}$$
Example 1
Let's check that $623$ is divisible by $89$.
Its prenumber is $p=62$ and $u=3$.
Taking the value in the table (I'll take the positive one): $k=9$
So substituting the values:
$p+ku=62+9\cdot 3=89$ which, trivially, is divisible by $89$, so $623$ is divisible by $89$
Example 2
Let's check that $1241$ is divisible by $73$.
Its prenumber is $p=124$ and $u=1$.
Taking the value in the table (I'll take the negative one): $k=-51$
$p+ku=124-51\cdot 1\cdot 1=73$ which, trivially again, is divisible by $73$, so $1241$ is divisible by $73$
Example 3
Let's check that $4171$ is divisible by $97$.
Its prenumber is $p=417$ and $u=1$.
Taking the value in the table (I'll take the negative one): $k=-29$
$p+ku=417-29\cdot 1=388$, which is divisible by $97$ ($388=94\cdot 4$), so $4171$ is divisibile by $97$
Example 4
Let's check that $943$ is divisible by $29$.
Its prenumber is $p=94$ and $u=3$.
Taking the value in the table (I'll take the positive one): $k=3$
$p+ku=94+3\cdot 3=103$, which is not divisible by $29$ ($103$ is a prime number), so $943$ is not divisibile by $29$
Question
I specify that I have never demonstrated this and right now I wouldn't be able to, I wanted to know if this algorithm already existed and had a name (and if so, does it have a demonstration).
solution-verification
question to be on topic you must specify precisely which step in the proof you question, and why so. This site is not meant to be used as a proof checking machine. – Bill Dubuque Jan 07 '24 at 19:09