A277549 Numbers k such that k/4^m == 1 (mod 4), where 4^m is the greatest power of 4 that divides k.
1, 4, 5, 9, 13, 16, 17, 20, 21, 25, 29, 33, 36, 37, 41, 45, 49, 52, 53, 57, 61, 64, 65, 68, 69, 73, 77, 80, 81, 84, 85, 89, 93, 97, 100, 101, 105, 109, 113, 116, 117, 121, 125, 129, 132, 133, 137, 141, 144, 145, 148, 149, 153, 157, 161, 164, 165, 169, 173
Offset: 1
Links
- Clark Kimberling, Table of n, a(n) for n = 1..10000
- Index entries for 2-automatic sequences.
Programs
-
Maple
filter:= n -> n/2^(2*floor(padic:-ordp(n,2)/2)) mod 4 = 1: select(filter, [$1..1000]); # Robert Israel, Oct 20 2016
-
Mathematica
z = 160; a[b_] := Table[Mod[n/b^IntegerExponent[n, b], b], {n, 1, z}]; p[b_, d_] := Flatten[Position[a[b], d]]; p[4, 1] (* A277549 *) p[4, 2] (* A036554 *) p[4, 3] (* A055050 *)
-
PARI
isok(n) = n/4^valuation(n,4) % 4 == 1; \\ Michel Marcus, Oct 20 2016
-
Python
from itertools import count, islice def A277549_gen(startvalue=1): # generator of terms >= startvalue return filter(lambda n:(n>>((~n&n-1).bit_length()&-2))&3==1,count(max(startvalue,1))) A277549_list = list(islice(A277549_gen(),30)) # Chai Wah Wu, Jul 09 2022
-
Python
def A277549(n): def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 kmin = kmax >> 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): return n+x-sum(((x>>(i<<1))-1>>2)+1 for i in range((x.bit_length()>>1)+1)) return bisection(f,n,n) # Chai Wah Wu, Mar 19 2025
Comments