how to verify a DEA number?

Source: U.S. Drug Enforcement Administration (DEA)

First of all, health practitioners such as doctors must obtain a registration number from the Drug Enforcement Administration (DEA) in order to prescribe controlled substances such as hydrocodone.
In other words, health practitioners can not prescribe narcotic analgesics or any other controlled substance without a DEA number. This number identifies the health practitioner with the Drug Enforcement Administration. It is a unique number based on a mathematical calculation.

A valid DEA number consists of 2 letters, 6 digits, and 1 check digit. The first letter is a code identifying the type of registrant. The second letter is the first letter of the registrant's last name.

Here are the steps to verify a DEA number:
Step 1: add the first, third, and fifth digits of the DEA number.

Step 2: add the second, fourth, and sixth digits of the DEA number.

Step 3: multiply the result of Step 2 by two.

Step 4: add the result of Step 1 to the result of Step 3.
Then, the last digit of this sum must be the same as the last digit of the DEA number.

Example: DEA number AP5836727
Step 1: 5 + 3 + 7 = 15
Step 2: 8 + 6 + 2 = 16
Step 3: 16 * 2 = 32
Step 4: 15 + 32 = 47