login
A278032
a(n) is the smallest positive integer not already in the sequence such that Sum_{i=1..n} binary_weight(a(i)) is prime.
2
3, 1, 5, 6, 15, 9, 23, 10, 27, 63, 12, 95, 29, 17, 30, 111, 119, 18, 123, 39, 20, 125, 43, 126, 255, 45, 24, 46, 33, 51, 16383, 53, 159, 34, 1023, 36, 175, 183, 54, 187, 189, 40, 1535, 48, 57, 65, 4095, 6143, 58, 66, 60, 190, 68, 1791, 207, 215, 219, 72, 221, 71
OFFSET
1,1
COMMENTS
A binary analog of A269415.
Clearly 1 is the only term of odd weight that can appear, and if it is true (which is not presently known) that there infinitely many prime gaps of 2, 4, 6, 8, etc. then every number of even weight will appear.
MATHEMATICA
a[1] = 3; a[n_] := a[n] = Module[{k = 1, s = Sum[DigitCount[a[i], 2, 1], {i, 1, n - 1}]}, While[!FreeQ[Array[a, n - 1], k] || !PrimeQ[s + DigitCount[k, 2, 1]], k++]; k]; Array[a, 100] (* Amiram Eldar, Jul 18 2023 *)
CROSSREFS
Cf. A000120 (binary weight), A269415.
Sequence in context: A256504 A205713 A254344 * A016600 A130418 A038871
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Nov 11 2016
EXTENSIONS
a(13) corrected by Chai Wah Wu, Nov 11 2016
More terms from Chai Wah Wu, Nov 11 2016
STATUS
approved