login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A307096 Positive integers m such that for any positive integer k the last k bits of the binary expansion of m is not a multiple of 3. 0

%I #26 May 03 2019 21:35:04

%S 1,5,13,17,29,37,49,61,65,77,101,113,125,133,145,157,193,205,229,241,

%T 253,257,269,293,305,317,389,401,413,449,461,485,497,509,517,529,541,

%U 577,589,613,625,637,769,781,805,817,829,901,913,925,961,973,997,1009

%N Positive integers m such that for any positive integer k the last k bits of the binary expansion of m is not a multiple of 3.

%C The number of terms less than 2^n is the n-th Fibonacci number F(n), A000045.

%C The number of terms between 2^(n-1) and 2^n in the sequence is the Fibonacci number F(n-2), A000045.

%C If 2^(n-1) <= x < 2^n, then x is in the sequence if and only if x is not divisible by 3 and x - 2^(n-1) is in the sequence. - _Robert Israel_, Apr 25 2019

%F (a(n)+1)/2 = A219608(n), the n-th odd term in A060142.

%e 29 is 11101_2 and none of 11101_2, 1101_2, 101_2, 1_2 are divisible by 3.

%p f := n-> if(n != 0, add(2^(k-1)*`if`((n mod 2^k) mod 3 = 0, 1, 0), k = 1 .. ceil(log(n)/log(2))), 0);

%p ker := []; for n from 1 to 1024 do if f(n) = 0 then ker := [op(ker), n] end if end do; ker;

%p # Alternative:

%p A1:= {1}: A2:= {}:

%p for d from 1 to 12 do

%p if d::odd then A1:= A1 union map(`+`,A2,2^d)

%p else A2:= A2 union map(`+`,A1,2^d)

%p fi

%p od:

%p sort(convert(A1 union A2,list)); # _Robert Israel_, Apr 25 2019

%t Select[Range[10^3], Function[s, NoneTrue[Array[FromDigits[Take[s, -#], 2] &, Length@ s], Mod[#, 3] == 0 &]]@ IntegerDigits[#, 2] &] (* _Michael De Vlieger_, Mar 24 2019 *)

%o (PARI) isok(n) = {if (n % 3, my(b=binary(n)); for (k=1, #b-1, b[k] = 0; if ((fromdigits(b, 2) % 3) == 0, return (0));); return (1);); return (0);} \\ _Michel Marcus_, Apr 24 2019

%Y Cf. A060142, A219608, A000045.

%K easy,base,nonn

%O 1,2

%A _John Rickert_, Mar 24 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 10:39 EDT 2024. Contains 371967 sequences. (Running on oeis4.)