Friday, March 14, 2025

pi.py day: "vibe coding" with AI

How good is AI for writing code?
Generating unlimited digits of "pi" is not an easy task.
So I prompted Sonnet 3.7 (on Claude, made by Anthropic) to do it.
And it did! See code below.
This is apparently now called "Vibe coding" :)


Pi Day is an annual celebration of the mathematical constant π (pi). Pi Day is observed on March 14 (the 3rd month) since 3, 1, and 4 are the first three significant figures of π

before we look at fancy AI solution, let's se result of "HI" (Human Intelligence)

decimals = 1000; x = 3 * (10 ** int(decimals + 20)); i = 1; pi = x
while x > 0: x = x * i // ((i + 1) * 4); pi += x // (i + 2); i += 2
print(pi // (10 ** 20))

or equivalent in JavaScript:

let decimals = 1, i = 1n, x = 3n * (10n ** BigInt(decimals + 20)), pi = x;
while (x > 0) { x = x * i / ((i + 1n) * 4n); pi += x / (i + 2n); i += 2n; }
console.log(pi / (10n ** 20n));

This is much more compact and faster than AI solution below, and is based on this:


The speed advantage is because BigInt is faster than "decimal".


another previous multi-language solution.

Vibe coding - Wikipedia

Vibe coding is an AI-dependent computer programming practice where a person describes a problem in a few sentences as a prompt to a large language model (LLM) tuned for coding. The LLM generates software, freeing the programmer from having to write and debug the underlying code.[1][2][3] Vibe coding is claimed by its advocates to allow even amateur programmers to produce software without the extensive training and skills which coding previously needed.[4] The term was introduced by Andrej Karpathy in February 2025

data: vehicles, vin decoder database

 Vehicle API

The NHTSA Product Information Catalog Vehicle Listing (vPIC) Application Programming Interface (API) provides different ways to gather information on Vehicles and their specifications. The vPIC Dataset is populated using the information submitted by the Motor Vehicle manufacturers

//vpic.nhtsa.dot.gov/api/

A standalone vPIC Database is now available for developers to implement VIN decode on their end instead of calling or APIs. Please click the Download button below to download the vPIC database as a backup file created using MS SQL Server 2019.

/vehicles/DecodeVinValues/5UXWX7C5*BA?format=json&modelyear=2011



In 1981, the National Highway Traffic Safety Administration of the United States standardized the format.[2] It required all on-road vehicles sold to contain a 17-character VIN