The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A226228 Numbers m such that all lengths of runs of 1's in the binary representation of m are prime numbers. 4

%I #10 Jun 05 2013 15:11:38

%S 3,6,7,12,14,24,27,28,31,48,51,54,55,56,59,62,96,99,102,103,108,110,

%T 112,115,118,119,124,127,192,195,198,199,204,206,216,219,220,223,224,

%U 227,230,231,236,238,248,251,254,384,387,390,391,396,398,408,411,412,415,432

%N Numbers m such that all lengths of runs of 1's in the binary representation of m are prime numbers.

%H Reinhard Zumkeller, <a href="/A226228/b226228.txt">Table of n, a(n) for n = 1..10000</a>

%t Select[Range@432, And @@ PrimeQ[(Length /@ Split@ IntegerDigits[#, 2])[[;; ;; 2]]] &] (* _Giovanni Resta_, Jun 01 2013 *)

%o (C)

%o #include <stdio.h>

%o #include <stdlib.h>

%o typedef unsigned long long U64;

%o U64 runs[] = {0,2,3,5,7,11,13,17,19,23,29,31,37,41,43}, *wr;

%o #define MemUSAGE 1ULL<<33

%o #define TOP (1ULL<<9) // <<40 ok if MemUSAGE = 1ULL<<33

%o int compare64(const void *p1, const void *p2) {

%o if (*(U64*)p1 == *(U64*)p2) return 0;

%o return (*(U64*)p1 < *(U64*)p2) ? -1 : 1;

%o }

%o void rec(U64 bits) {

%o for (U64 i = 0, b; (b = ((bits*2+1) << runs[i])-1) < TOP; ++i)

%o if (b) *wr++ = b, rec(b);

%o }

%o int main() {

%o U64 *wr0 = (wr = (U64*)malloc(MemUSAGE));

%o rec(0);

%o //printf("%llu\n", wr-wr0);

%o qsort(wr0, wr-wr0, 8, compare64);

%o while (wr0<wr) printf("%llu, ", *wr0++);

%o return 0;

%o }

%o (Haskell)

%o import Data.List (group, genericLength)

%o a226228 n = a226228_list !! (n-1)

%o a226228_list = filter (all (== 1) .

%o map (a010051 . genericLength) .

%o other . reverse . group . a030308_row) [1..]

%o where other [] = []; other [x] = [x]; other (x:_:xs) = x : other xs

%o -- _Reinhard Zumkeller_, Jun 05 2013

%Y Cf. A033015, A226227, A226229.

%Y Cf. A005811, A030308, A010051.

%K nonn,base

%O 1,1

%A _Alex Ratushnyak_, May 31 2013

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 June 6 00:30 EDT 2024. Contains 373110 sequences. (Running on oeis4.)