Skip to content(if available)orjump to list(if available)

Is-even-ai – Check if a number is even using the power of AI

s1mplicissimus

This package has saved me so many hours of tedious gruntwork. It's like a junior developer - you still have to manually check their work, but when it's correct, it's a great productivity improvement.

And don't forget where this will go in a couple years with improved models and more computing power, it's gonna be awesome!

[/i]

1k

This exactly. It is more important to move fast. Screw the edge cases. As long as it’s correct _most_ of the time, you can always fix anything that’s broken tomorrow.

pavel_lishin

It's called "eventual consistency".

sho_hn

And C10k was never about those 10.000 socket connections getting the right response, either!

whatever1

Why on earth did the software engineering interviews were checking candidates’ ability to think about edge cases? Clearly management does not care.

sho_hn

Developers who aren't using it are already falling behind.

SamBam

Remember, it's not that AI that will take your job, it's the developers who need an AI to tell them if a number is even that will take your job.

darepublic

pro tip: play around with the temperature especially when using big numbers as input

hzambo

Wow, amazing tip. This hack improved my workflow by 10x.

Waterluvian

Only 9x for me. What am I doing wrong? Can you share your vscode colour scheme file?

koakuma-chan

Are there actually still Junior Developers out there? I thought no one is hiring Junior Developers.

ArthurStacks

Its actually the opposite of how people think.

We hire junior devs, but not senior, and dont replace our senior devs. So our developer base is moving towards being junior weighted with less senior. The reason being a junior dev is cheaper, complains less, is more capable now through utilising generative AI, works harder to impress knowing they arent in a safe position, and we can let them go more easily with less process and less reasons needed to be given.

android521

you're so wrong. This only works if what you do is so simple that any junior develper can sufficiently do it well. Senior developers with AI is gonna destroy a bunch of junior developers with AI.

echelon

You laugh now, but our jobs are going to be toast in 10 years.

I thought self-driving would never happen, and now it's here.

margalabargala

Almost here. Elon said Full Self Driving would mean full self driving within a year! That means we are less than 12 months away from not needing to drove ourselves anymore.

echelon

I was talking about Waymo. It's real and it's spreading everywhere.

Give it another 10-20 years and your job will probably face the same fate.

null

[deleted]

iamthemonster

This is pretty useless to be honest. It's good for telling whether a number is even, but in our industry we need more powerful functionality. We also need to know whether a number is odd.

charles_f

RTFM, it's not only implementing isOdd but also a large set of rarely used advance operations such as isEqual, or isGreaterThan

Trully AI is astonishing

whynotmaybe

Why a specific function ?

With a few lines of code, you can just create a list with all the numbers that are even and when you need to check if a number is odd, you simply have to check if it's in the list.

turnsout

Yes, this is what we do as a RAG workflow. We created a list of all 32bit unsigned integers and whether they were even or odd, and we pass that into the context. The future is amazing!

MikeTheGreat

I'm new to RAG and have a question: how do you get all the numbers into the context window?

Does the RAG part look up just the needed number?

I think that Gemini has a million token window (yes?) - do you have access to a model with a larger window?

Regardless, I find your ideas intriguing and wish to subscribe to your Substack.

Charon77

I.. can't tell if you're joking or not. Pretty sure someone out there is unironically doing something as stupid as this in production

sureIy

Do we have enough spaces in the ALL_NUMBERS array or do we want to group them by thousands?

ALL_NUMBERS_00001

ALL_NUMBERS_00002

iamthemonster

we fired all our junior devs so we can't write code any more

briansm

"This is pretty useless to be honest."

I remember saying that about Bitcoin 15 years ago.

crubier

You can achieve this super simply this by prompting the OpenAI API to call this tool and reverse the output.

SamBam

I tried that, but I kept getting "eurt" and "eslaf" and I'm not sure what to do with those. Do I need to send it back to the AI?

YokoZar

Great news! The package includes an isOdd function as well!

Cerium

Simply add one to the number and then test it again.

avandekleut

Someone should implement this using tool calls.

parpfish

Use this to add AI to your product to appease management.

Next week, “refactor” it out and brag to manager about cost savings and performance boosts, don’t mention “removing the AI”.

freetime2

Boss: What have you been working on for the last quarter?

Me: I leveraged Deep Intelligence to build a Next-Gen Parity Classifier with 99.9% accuracy.

lrvick

NPM packages can never be removed once added to a codebase. You can only add more.

mitthrowaway2

Is there a version I can run locally? I don't want OpenAI training on my integers.

avs733

you need the roomHeater fork. It uses the Climate Change 1.5C license

squillion

I can’t even.

bosky101

Sorry for the offtopic post, but I am looking to hire someone with 10 years of experience with is-even-ai. Urgent. Your first unpaid assignment will be to help load balance a bunch of MCP servers to add and THEN check if it's even. So much to go from here! We're a single threaded GPU first identity operator company with a lot history of returning the same thing. We're now expanding to combine and add multiple things. In 6 months of SOTA fine tuning we can already add upto 3 numbers. An MCP first. With temperature 1 we even add random numbers. An industry first. And we're just getting started. Join us. We're adding to our team!

jasonjmcghee

You might be able to optimize this by using embeddings. Store all the numbers and search "odd" and "even" until you find your number.

asidiali

This hit way too close to home, I’m cackling.

ukuina

This doesn't work if I use a reasoning model like o3, which does not allow setting max_tokens.

Without reasoning, how can I be SURE a number is even?

parpfish

I think before you would deploy this to prod, you should wrap it with a few guardrails to make sure it’s not hallucinating. Pretty simple — just take the output from the llm and see if it agrees with a simple mod2 operation.

Of it agrees, return model output to the user. Otherwise do a couple of retries with different prompts.

mrheosuper

mod2 is outdated and has not been updated for years, nobody uses it anymore

hartator

Multiple models?

downboots

Is this program even? Something about it feels very odd.

[0] https://stackoverflow.com/questions/22969183/is-every-progra...

joshka

Can we get a leftpad-ai please?

fooker

Ahem secure-left-ai-405b-quantized.

crazysim

How reliable is this? I'm half joking too but I wouldn't mind reading a report comparing this on OpenAI and various other LLMs.

Somehow I doubt it'll be 100%... right?

nop_slide

Might be more reliable to ask it to generate a JS function to compute is-even, then just js eval the returned code with the args.

What could go wrong

geor9e

normally llms are pretty bad at math, but in this case it should just look at the final digit and map 10 values which I can't imagine going wrong

gruez

I tried with this on chatgpt.com (anonymous) and it was wrong:

>You are an AI assistant designed to answer questions about numbers. You will only answer with only the word true or false.

>Is 393330370227914821469106615363204944758938252979261537157082994586230072180858944545028761701928694832864623009988147774229437650643225379825905427239525512110359581021414640894111281701792224552922491447051506246553646282117414112976459608594044929244664050172002138933343230226871897567 an even number?

response:

>True

The prompt was the same used as the library: https://github.com/Calvin-LL/is-even-ai/blob/b00dbfcbb89a197...

Too

To be fair, Javascript double point precision get tripped up by such large numbers as well.

daemonologist

The tokenizer might lump the last digit together with some preceding digits though. I know o200k_base (OpenAI -o models) tends to give groups of three (900001 for example is 900-001).

Anyway, I wouldn't be surprised if a non-finetuned model made some mistakes.

crazysim

I'm just curious how _low_ can you go before it does go wrong.

bigbuppo

I mean if this were a check for primes the answer would be 1.

timewizard

is 0x2a even?

est

its as accurate as how Tiktokenizer deal with numeral characters

ashton314

…but there’s only one dependency!! This goes against the NPM ethos of importing anything and everything that you might be tempted to just handle yourself. I’ll be waiting for the Enterprise Version that uses the appropriate number of dependencies.