cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A356385 First differences of A353654 which is numbers with the same number of trailing 0 bits as other 0 bits.

This page as a plain text file.
%I A356385 #53 Nov 07 2024 11:12:06
%S A356385 2,4,3,5,7,4,5,5,10,8,4,5,13,8,10,6,10,8,4,5,9,20,16,8,10,14,8,10,6,
%T A356385 10,8,4,5,25,16,20,12,20,16,8,10,10,20,16,8,10,14,8,10,6,10,8,4,5,17,
%U A356385 40,32,16,20,28,16,20,12,20,16,8,10,26,16,20,12,20,16
%N A356385 First differences of A353654 which is numbers with the same number of trailing 0 bits as other 0 bits.
%F A356385 a(n) = A353654(n+1) - A353654(n) for n > 0.
%F A356385 a(A000045(n)-1) = 5 for n > 4.
%t A356385 Differences @ Join[{1}, Select[Range[2, 1000], IntegerExponent[#, 2] == Floor[Log2[# - 1]] - DigitCount[# - 1, 2, 1] &]] (* _Amiram Eldar_, Sep 21 2022 *)
%o A356385 (PARI) isok(k) = if (k==1, 1, (logint(k-1, 2)-hammingweight(k-1) == valuation(k, 2))); \\ A353654
%o A356385 lista(nn) = my(v=select(isok, [1..nn])); vector(#v-1, k, v[k+1] - v[k]); \\ _Michel Marcus_, Sep 21 2022
%o A356385 (Python 3.10+)
%o A356385 from itertools import pairwise, count, islice
%o A356385 def A356385_gen(): # generator of terms
%o A356385     return map(lambda x:x[1]-x[0],pairwise(filter(lambda n:(~n & n-1).bit_length()<<1 == n.bit_length()-n.bit_count(),count(1))))
%o A356385 A356385_list = list(islice(A356385_gen(),30)) # _Chai Wah Wu_, Oct 14 2022
%Y A356385 Cf. A000045, A353654.
%K A356385 nonn,base
%O A356385 1,1
%A A356385 _Mikhail Kurkov_, Aug 05 2022