|
|
A094934
|
|
Write binary digits of numbers 1, 2, 3, ... in a string; sequence gives the prime indexed digits.
|
|
1
|
|
|
1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
LINKS
|
|
|
EXAMPLE
|
In 1 10 11 100 101 110 111 1000 ... the prime indexed digits are 1,0,1,0,1,1,1,0
|
|
MATHEMATICA
|
almostNatural[n_, b_] := Block[{m = 0, d = n, i = 1, l, p}, While[m <= d, l = m; m = (b - 1) i*b^(i - 1) + l; i++]; i--; p = Mod[d - l, i]; q = Floor[(d - l)/i] + b^(i - 1); If[p != 0, IntegerDigits[q, b][[p]], Mod[q - 1, b]]]; Table[ almostNatural[n, 2], {n, Prime@ Range@ 105}] (* Robert G. Wilson v, Jun 29 2014 *)
|
|
PROG
|
(PARI) { x=1; xlc=0; xl=0; forprime (p=2, 1000, fl=1; if (xlc>=p && xlc-xl<p, fl=0; print1(", "xb[p-xlc+xl])); while (fl==1, xb=binary(x); xl=length(xb); xlc+=xl; if (xlc>=p && xlc-xl<p, fl=0; print1(", "xb[p-xlc+xl])); x++)) }
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|