[go: up one dir, main page]

login
Revision History for A342991 (Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
Left(0)/right(1) turning sequence needed to traverse the Stern-Brocot tree (A007305, A047679) from the root down to e (A001113).
(history; published version)
#75 by N. J. A. Sloane at Mon Jan 16 08:17:51 EST 2023
STATUS

proposed

approved

#74 by Paolo Xausa at Fri Dec 02 06:00:01 EST 2022
STATUS

editing

proposed

Discussion
Sun Jan 01
00:23
Andrew Howroyd: A358510 contains positions of 1's and A358511 positions of 0's (opposite to comment)
02:15
Paolo Xausa: Andrew: no, look at edits #5 onwards in both A358510 and A358511.
Thu Jan 05
15:06
Paolo Xausa: (...or just look at the now published A358510 and A358511).
#73 by Paolo Xausa at Fri Dec 02 05:57:16 EST 2022
MATHEMATICA

iterA342991[i_]:=10Flatten[Array[{1, PadRight[{}, 4#], 1, 0, PadRight[{}, 2+4#, 1], 0}&, i, 0]]; (* Each iteration adds six runs of values *)

Flatten[Array[{1, PadRight[{}, 4#], 1, 0, PadRight[{}, 2+4#, 1], 0}&, iter, 0]] (* Paolo Xausa, Nov 20 2022 *)

A342991[10] (* Paolo Xausa, Nov 20 2022 *)

PROG

A342991(iter) =10 concat(vector(iter, i, concat([1, vector((i-1)<<2), 1, 0, vector(2+(i-1)<<2, x, 1), 0]))); \\ Each iteration adds six runs of values

concat(vector(iter, i, concat([1, vector((i-1)<<2), 1, 0, vector(2+(i-1)<<2, x, 1), 0]))) \\ Paolo Xausa, Nov 24 2022

A342991(10) \\ Paolo Xausa, Nov 24 2022

Discussion
Fri Dec 02
06:00
Paolo Xausa: Faster programs.
#72 by Paolo Xausa at Fri Dec 02 03:19:40 EST 2022
MATHEMATICA

iter=10; (* Each iteration adds six runs of values *)

#71 by Paolo Xausa at Fri Dec 02 03:18:49 EST 2022
MATHEMATICA

iter=10; (* Each iteration adds six runs of values *)

A342991[iter_]:=Module[{v=0}, Flatten[Array[{1-v, , PadRight[{}, 4#], 1, 0, PadRight[{}, 2+4#, v], v=1-v], 0}&, iter, 0]]]; (* Each iteration adds three runs of values _Paolo Xausa_, Nov 20 2022 *)

A342991[10] (* Paolo Xausa, Nov 20 2022 *)

PROG

iter=10; \\ Each iteration adds six runs of values

blockconcat(i)=myvector(v=iter, i%2); , concat([1-v, , vector((i-1)<<2), 1, 0, vector(2+(i-1, )<<2, x, v), 1-v), 0]); )) \\ _Paolo Xausa_, Nov 24 2022

A342991(iter)=concat(vector(iter, i, block(i-1))); \\ Each iteration adds three runs of values

A342991(10) \\ Paolo Xausa, Nov 24 2022

STATUS

proposed

editing

#70 by Paolo Xausa at Fri Nov 25 03:59:29 EST 2022
STATUS

editing

proposed

#69 by Paolo Xausa at Fri Nov 25 03:50:51 EST 2022
PROG

A342991block(iteri) = my(a=List(), v=0); for(i=0, iter-1, listput(a, %2); concat([1-v, vector(i<<1, x, v), v=1-v]))); concat(Vec(a)); \\ Each iteration adds three runs of values

A342991(iter)=concat(vector(iter, i, block(i-1))); \\ Each iteration adds three runs of values

STATUS

proposed

editing

Discussion
Fri Nov 25
03:59
Paolo Xausa: (yes, comparing arrays of same size)
(yes, of course both ways have their place)
Tweaked the program a bit, avoiding list(), now a bit faster.
#68 by Kevin Ryde at Thu Nov 24 15:17:02 EST 2022
STATUS

editing

proposed

Discussion
Thu Nov 24
15:35
Paolo Xausa: Yes, I tried creating a vector of the correct length first, but then manually inserting the correct values in the right places resulted in a much slower program. Using vector(n,i,a(i)); with your code, for example, is about 5 times slower (unless I'm missing something ovious, which is almost certain given that I'm a novice at PARI!). But your code is obviously better for calculating the nth term directly!
Fri Nov 25
02:02
Kevin Ryde: Lists or arrays is faster the sqrts.  (You're comparing arrays of same size yes.  Since iter makes, umm, iter*(iter+1) many terms.)
02:05
Kevin Ryde: (There can be a place for both ways.  An individual term is maximum flexibility and handles huge n, but it can indeed happen that a vector of terms is faster than one by one.)
#67 by Kevin Ryde at Thu Nov 24 15:15:33 EST 2022
PROG

(PARI) a(n) = my(r, s=sqrtint(n-1, &r)); bitand(s + (r<s-1 || r==s), 1); \\ Kevin Ryde, Nov 24 2022

#66 by Kevin Ryde at Thu Nov 24 15:10:27 EST 2022
PROG

(PARI)

A342991(iter) = my(a=List(), v=0); for(i=0, iter-1, listput(a, concat([1-v, vector(i<<1, x, v), v=1-v]))); concat(Vec(a)); \\ Each iteration adds three runs of values

A342991(10) \\ Paolo Xausa, Nov 24 2022

(PARI)

A342991(iter) = my(a=List(), v=0); for(i=0, iter-1, listput(a, concat([1-v, vector(i<<1, x, v), v=1-v]))); concat(Vec(a)); \\ Each iteration adds three runs of values

A342991(10) \\ Paolo Xausa, Nov 24 2022

STATUS

proposed

editing

Discussion
Thu Nov 24
15:11
Kevin Ryde: date order
15:13
Kevin Ryde: vector() is better than List() when you know the length (even if it looks like vectors within vectors within etc!).