A321513 Numbers that are periodic in base 4, written in decimal, where the base-4 expansion contains at least two periods.
5, 10, 15, 17, 21, 34, 42, 51, 63, 65, 68, 85, 102, 119, 130, 136, 153, 170, 187, 195, 204, 221, 238, 255, 257, 260, 273, 325, 341, 390, 455, 514, 520, 546, 585, 650, 682, 715, 771, 780, 819, 845, 910, 975, 1023, 1025, 1028, 1040, 1092, 1105, 1170, 1235, 1285
Offset: 1
Examples
The base-4 representation of 17 is 101, which is periodic when considering leading zeros, i.e., 0101, so 17 is a term of the sequence. The base-4 representation of 170 is 2222, which is periodic, so 170 is a term of the sequence. The base-4 representation of 1495 is 113113, which is periodic, so 1495 is a term of the sequence.
Programs
-
PARI
subvec(vec, pos, len) = my(w=[]); for(k=pos, pos+len-1, if(k > #vec, return(0), w=concat(w, vec[k]))); w is_perio(vec) = my(d=divisors(#vec), v=[], w=[]); for(x=2, #d-1, v=subvec(vec, 1, d[x]); forstep(y=1, #vec, d[x], w=subvec(vec, y, d[x]); if(w!=v, break, if(y+d[x] >= #vec, return(1))))); 0 is(n) = my(d=digits(n, 4), z=[]); if(#d < 2, return(0)); if(vecmin(d)==vecmax(d), return(1)); while(#z <= #d, if(is_perio(concat(z, d)), return(1)); z=concat(z, [0])); 0
-
PARI
is(n, b=4) = for (w=1, oo, my (d=digits(n, b^w)); if (#d<=1, return (0), #Set(d)==1, return (1))) \\ Rémy Sigrist, Nov 16 2018