AI PICK BASIC programming code

129 views
Skip to first unread message

Chris Long

unread,
Apr 21, 2025, 2:45:25 PMApr 21
to mvd...@googlegroups.com

Ø  I saw a "Hello World" routine written by AI that was supposed to be a Pick BASIC variant but wouldn't even compile. Looked more like Python than BASIC.

 

 

I submitted the following to Perplexity AI:

 

Please write a PICK BASIC program that will confirm the validity of an NPI number using the LUHN 10 algorithm.

 

The syntax was a bit different than REALITY Data Basic.  The follow up question was:

 Can you write the same program in REALITY DATA BASIC?

 

It returned the code below, which required one slight tweak.  It compiled, runs, and appears to work!

 

Chris Long

RA Services IT

804-613-3964

 

 

Here is a REALITY DATA BASIC program to validate an NPI number using the Luhn 10 algorithm, following the official NPI rules (prepend 80840 to the NPI, then apply Luhn):

text

* NPI Luhn 10 Validator in REALITY DATA BASIC

 

PRINT "Enter 10-digit NPI number: ":

INPUT NPI

 

NPI = TRIM(NPI)

IF LEN(NPI) # 10 THEN

    PRINT "Invalid NPI length."

    STOP

END

 

* Prepend '80840' per NPI Luhn rules

FULLNUM = "80840":NPI

 

SUM = 0

LENNUM = LEN(FULLNUM)

 

FOR I = LENNUM TO 1 STEP -1

    DIGIT = SEQ(FULLNUM, I)   SEQ(FULLNUM[I,1])

    IF DIGIT < 48 OR DIGIT > 57 THEN

        PRINT "Invalid character in NPI."

        STOP

    END

    DIGIT = DIGIT - 48

    POS = LENNUM - I + 1

    IF MOD(POS,2) = 0 THEN

        DIGIT = DIGIT * 2

        IF DIGIT > 9 THEN

            DIGIT = DIGIT - 9

        END

    END

    SUM = SUM + DIGIT

NEXT I

 

IF MOD(SUM,10) = 0 THEN

    PRINT "NPI is VALID."

END ELSE

    PRINT "NPI is INVALID."

END

 

Notes:

·         SEQ(string, position) returns the ASCII code of the character at position (standard in REALITY DATA BASIC).

·         The program checks for non-digit input and ensures the NPI is exactly 10 digits.

·         The Luhn algorithm is implemented per standard rules56.

You may need to adjust minor syntax depending on your specific REALITY DATA BASIC environment, but this is the canonical approach.

 

 

 

frosty

unread,
Apr 30, 2025, 11:17:08 AMApr 30
to Pick and MultiValue Databases
Nice. I'm gonna find out what is Perplexity AI and give it a look-see.

Soon, we'll be reminiscing, "I remember when AI developed code with hallucinations." 

Christopher Jeune

unread,
Apr 30, 2025, 11:18:15 AMApr 30
to mvd...@googlegroups.com
It’s missing line numbers

--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms
---
You received this message because you are subscribed to the Google Groups "Pick and MultiValue Databases" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mvdbms+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mvdbms/BYAPR04MB416569612867D422FBEF9B2FAAB82%40BYAPR04MB4165.namprd04.prod.outlook.com.

frosty

unread,
Apr 30, 2025, 11:21:28 AMApr 30
to Pick and MultiValue Databases
You're not old enough to remember line numbers!
Reply all
Reply to author
Forward
0 new messages