|
|
A226228
|
|
Numbers m such that all lengths of runs of 1's in the binary representation of m are prime numbers.
|
|
4
|
|
|
3, 6, 7, 12, 14, 24, 27, 28, 31, 48, 51, 54, 55, 56, 59, 62, 96, 99, 102, 103, 108, 110, 112, 115, 118, 119, 124, 127, 192, 195, 198, 199, 204, 206, 216, 219, 220, 223, 224, 227, 230, 231, 236, 238, 248, 251, 254, 384, 387, 390, 391, 396, 398, 408, 411, 412, 415, 432
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
MATHEMATICA
|
Select[Range@432, And @@ PrimeQ[(Length /@ Split@ IntegerDigits[#, 2])[[;; ;; 2]]] &] (* Giovanni Resta, Jun 01 2013 *)
|
|
PROG
|
(C)
#include <stdio.h>
#include <stdlib.h>
typedef unsigned long long U64;
U64 runs[] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43}, *wr;
#define MemUSAGE 1ULL<<33
#define TOP (1ULL<<9) // <<40 ok if MemUSAGE = 1ULL<<33
int compare64(const void *p1, const void *p2) {
if (*(U64*)p1 == *(U64*)p2) return 0;
return (*(U64*)p1 < *(U64*)p2) ? -1 : 1;
}
void rec(U64 bits) {
for (U64 i = 0, b; (b = ((bits*2+1) << runs[i])-1) < TOP; ++i)
if (b) *wr++ = b, rec(b);
}
int main() {
U64 *wr0 = (wr = (U64*)malloc(MemUSAGE));
rec(0);
//printf("%llu\n", wr-wr0);
qsort(wr0, wr-wr0, 8, compare64);
while (wr0<wr) printf("%llu, ", *wr0++);
return 0;
}
(Haskell)
import Data.List (group, genericLength)
a226228 n = a226228_list !! (n-1)
a226228_list = filter (all (== 1) .
map (a010051 . genericLength) .
other . reverse . group . a030308_row) [1..]
where other [] = []; other [x] = [x]; other (x:_:xs) = x : other xs
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|