Div3Net โ Divisibility-by-3 Classifier
A custom PyTorch classifier that predicts whether a non-negative integer is divisible by 3. Uses a digit histogram encoding: the input is a count of each digit (0-9) plus the total digit count, so the network cannot see digit order โ it must rediscover the digit-sum rule.
Architecture
- Input: 10 digit counts + 1 normalized digit-count feature
- Body:
layershidden layers ofhiddenunits, ReLU between them - Output: single logit
- Params: ~135K per model, ensemble of N models
Checkpoint format
The file div3_model.pt is a dict with:
format_version: 4config:{MAX_DIGITS, hidden, layers, num_models, encoding}state_dicts: list ofstate_dictobjects, one per ensemble member
Load with the model.py file from the same project.
Performance
~99.8% on held-out random numbers spanning 1 to 50 digits.
Test
Note: this is just for testing PyTorch.
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support