Code for OEIS A334820

OEIS sequences A334820 and A335599 by Richard Blavy are based on certain replications which have some interesting connections to the existence of solutions to m + hammingweight(m) = n-1 or n.

A334820 = 0,1,0,1,1,0,1, 0,1,1,0,1, ...
A335599 = 0,0,1,1,2,3,3, 5,5,6,7,7, ...

The PARI/GP code here is a mixture of code, description, formulas, why it works, and self-tests, for my recurrence and resulting bit-twiddling to calculate an isolated term, and further interpretations as unique sums and hammingweight solutions. is free software (free as in freedom), published under the terms of the GNU General Public License (v3 or higher). Download version 12 July 2020,

The sig file is a Gnu PG ascii armoured signature generated from my key.

This is slightly still work-in-progress. Believe correct, but with minor or major rearrangements or more ideas to come. It might become an upload in the sequence eventually (either instead or as well as here). Maybe further variations on the sequences are possible too.

This page Copyright 2020, 2021 Kevin Ryde.

(Back to the sitemap.)