Skip to content

Instantly share code, notes, and snippets.

@maciejzgadzaj
Created November 22, 2016 13:37
Show Gist options
  • Save maciejzgadzaj/b761724aaf0051653a81131e8c5e1e2f to your computer and use it in GitHub Desktop.
Save maciejzgadzaj/b761724aaf0051653a81131e8c5e1e2f to your computer and use it in GitHub Desktop.
$siren = mt_rand(100000000, 999999999);
$key = (12 + 3 * ($siren % 97)) % 97;
print 'FR' . $key . $siren;
@Shide
Copy link

Shide commented Jun 1, 2022

On Python:

from random import randint

def generate_fr_vat():
    siren = randint(100000000, 999999999)
    key = (12 + 3 * (siren % 97)) % 97
    return f"FR{key}{siren}"

@IMADMEDIA
Copy link

French VAT number generator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment