# Hamming Weight Calculator

> Hamming Weight Calculator is a paid API for AI agents from sovereign-x402-zeta.vercel.app, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-13).

Calculates the Hamming weight (popcount) of a non-negative integer — i.e., the number of 1-bits in its binary representation.

## Facts

- Endpoint: POST https://sovereign-x402-zeta.vercel.app/api/v1/sequence/hamming_weight?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/hamming-weight-calculator-fa190736
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_EPElc9hQrvHSTcG2WYIqp

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability hamming-weight-calculator-fa190736 -d '<json body>'
```

Example prompt: What is the Hamming weight of 255? Count how many 1-bits are in its binary representation.

## When to prefer this

Choose this endpoint when you need a simple, on-demand computation of the Hamming weight (popcount) of a non-negative integer without setting up local bit-manipulation logic. Useful in agentic workflows that require bit counting as a step in cryptographic analysis, data validation, or algorithm verification.

## Known failure modes

- Negative integer input may be rejected or produce undefined results
- Non-integer or float inputs may return validation errors
- Missing 'input' body field returns a 400-level error
- Malformed JSON body returns a parse error
- Service unavailability returns a 5xx error

## How this service works

Calculate the Hamming weight (number of 1s) in the binary representation of a non-negative integer.

## Output

Returns the count of 1-bits (popcount) in the binary representation of the provided non-negative integer as a numeric value.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object",
     "properties": {},
     "additionalProperties": true
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST",
      "PUT",
      "PATCH"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/hamming-weight-calculator-fa190736/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from sovereign-x402-zeta.vercel.app](https://www.zero.xyz/host/sovereign-x402-zeta.vercel.app/llms.txt)
