Since 1911 when the Navy purchased it's first Curtiss Triad pusher floatplane, the Navy's Bureau of Aeronautics "Bureau Number" system has undergone several changes. In 1945 the BUNO system evolved to a six digit system that has reached over 169000. Bureau Numbers are assigned in the fiscal year when an aircraft is ordered, not when it is actually delivered to the Navy.
On July 1, 1921 (the beginning of FY 1922) the United States Army Air Corps adopted the current Air Force Serial Number System based on when an aircraft was procured within the Fiscal Year. Each serial number consists of a base number corresponding to the last two digits of the FY in which money was allocated to manufacture the aircraft, and a sequence number indicating the sequential order in which the particular aircraft was ordered within that particular FY. For example, airplane 22-1 was the first aircraft ordered in FY 1922 and airplane 18-5860 was the 5860th aircraft ordered in Fiscal Year 2018 (assigned to a Lockheed Martin AC-130J Hercules).
Following the splitoff of the USAF from the US Army, the Army continued to use the same serial number system for its aircraft, with the serials for Army and Air Force aircraft being intermixed within the same FY sequence. Beginning in FY 1967, the Army began using serials beginning at 15000 for each FY, so Army aircraft could usually be distinguished from USAF aircraft by their high serial numbers. In addition, if an Army aircraft of helicopter had a serial number with less than 4 digits, extra zeros were added to pad the number out to 5 digits. In FY 1971, the Army went over to a new serial series for their helicopters, which started at 20000 and had continued consecutively since then. Within each FY, the US Army numbers are much higher than the USAF numbers are ever likely to get, so there is not much danger of any overlap.
The Coast Guard acquired a lot of its aircraft as transfers from the Air Force or the Navy. Nearly all of the aircraft that were transferred to the Coast Guard from the US Navy or from the US Air Force served with the Coast Guard under their original serial numbers, not being allocated a separate USCG serial number. However, the system was not always consistent, and sometimes aircraft transferred from the Navy or the Air Force were indeed assigned separate Coast Guard serials. Some aircraft types (e. g. the CASA C-212, the MH-65A, and the MH-90 used truncated construction numbers as their USCG serials, and displayed a truncated version of the MSN to produce a four-digit serial number. This system can be quite confusing, and unlike the USAF or the US Navy, the Coast Guard serial numbers are not necessarily in the same sequence as they were ordered into service.