Jakube
  • Member for 7 years, 6 months
  • Last seen this week
Decompose binary into alternating subsequences
3 votes

Pyth, 22 21 bytes &Qu?q%G2H& GH+yGHjQ2Z Try it online: Demonstration Really a tedious task in Pyth. Explanation: &Qu?q%G2H&\nGH+yGHjQ2Z implicit: Q = input number ...

View answer
Robot on a ladder
1 votes

Pyth, 19 bytes x.u@[tWNNhN00)CYz0Q Try it online: Demonstration or Test Suite Explanation: x.u@[tWNNhN00)CYz0Q implicit: z = input string, Q = input number .u z0 reduce z: for ...

View answer
The Unholy numbers
3 votes

Pyth, 31 29 27 25 bytes smhS.e?}b"04689"akd.n4zUz Try it online: Demonstration or Test Suite For each digit I compute the distances to each number. A distance is infinty, if the second digit is not ...

View answer
Output all strings
3 votes

Pyth, 7 bytes .V0j^zb Alternative to @fry. This program reads a string and keeps on printing strings until infinity. Explanation: .V0 for b in (0 to infinity): ^zb compute all ...

View answer
Generate lazy values
3 votes

Pyth, 16 bytes haDQsM*M*`MTSl`Q Try it online: Demonstration or Test Suite Explanation: haDQsM*M*`MTSl`Q implicit: Q = input number `Q convert Q to a string l ...

View answer
The middle-square method
2 votes

Pyth, 21 bytes tl.us_<>_`^N2/lz2lzsz Try it online: Demonstration or Test Suite edit: Found the edge case 1000, which didn't worked with my previous code. Fixed it for 1 byte. Explanation: ...

View answer
Implement the divisibility-by-7 rule
6 votes

Pyth, 13 bytes .W>H9-/ZTyeZQ Try it online: Demonstration or Test Suite This will print all the alternative answers. Explanation: .W>H9-/ZTyeZQ Q read a number from input ....

View answer
To be or not to be
7 votes

Pyth, 34 bytes .A}Lrw1c2c." Wô-WûÄæ­§Òé } Try it online: Demonstration Explanation: ."... packed string, gets decoded to: "2 TO TOO TWO T0 B BE BEE B3" c split by ...

View answer
Rearranging the sequence
3 votes

Pyth, 18 bytes /F.!M+lJ.njRTQ/LJT Try it online: Demonstration /F.!M+lJ.njRTQ/LJT implicit: Q = input number jRTQ convert each number in [0, ..., Q-1] to their digits .n ...

View answer
Find the Cross Product
4 votes

Pyth, 16 bytes -VF*VM.<VLQ_BMS2 Try it online: Demonstration Explanation: -VF*VM.<VLQ_BMS2 Q = input, pair of vectors [u, v] S2 creates the list [1, 2] _BM ...

View answer
Construct the Identity Matrix
8 votes

Pyth, 7 bytes XRm0Q1Q Try it online: Demonstration Creating a matrix of zeros and replacing the diagonal elements with ones.

View answer
Compute the multinomial coefficient
1 votes

Pyth, 10 bytes /F.!MaQ-FQ Try it online: Demonstration Explanation: /F.!MaQ-FQ implicit: Q = input list -FQ reduce Q by subtraction aQ append the result to Q .!M ...

View answer
Pyth Practice 2
Accepted answer
1 votes

54 bytes Here are the intended solutions. Except for task 8 all solutions were found.

View answer
Chinese Zodiac of the year
Accepted answer
5 votes

Pyth, 54 bytes @rR3c."ayÖÚ©*ÐPk<`eüµÜxþ!¬Ì ¾½hÑðÙBwp"\c.d3 Try it online: Demonstration You can replace the last 3 chars .d3 with any year number to test the other Zodiac animals. Explanation: ...

View answer
Compute the Binary Sierpinski Triangle Sequence
2 votes

Pyth, 7 bytes uxyGGQ1 Try it online: Demonstration Explanation: u Q1 apply the following statement input-times to G=1: xyGG update G with (2*G xor G)

View answer
Properties of Binary Functions
Accepted answer
4 votes

Pyth, 51 bytes [qKUQ@VQKCIQ}]Km{@RdCBQKJ!-sQK&JqF.bsm@L@QdYN.p,sQK Try it online: Demonstration or Test Suite This prints a list of 5 boolean values. They indicate the properties in the order: ...

View answer
The Kimberling Sequence
Accepted answer
3 votes

Pyth, 22 bytes JS*3QVQ@JN=J.i>JhN_<JN Try it online: Demonstration Simply performs the shuffling technique described in the OP. Explanation: JS*3QVQ@JN=J.i>JhN_<JN JS*3Q ...

View answer
Maximizing output from minimal input
9 votes

Pyth, 26 + 1140850688 + (>4.37 × 1020201781) I have no idea if it is possible to calculate the exact length of the output for the third program. I can only give boundaries. It'll print something ...

View answer
Map a random number to pi
Accepted answer
5 votes

Pyth, 25 bytes u&p?}HGH\x.-GH`.n0<`O017 Try it online: Demonstration or Test showing the random number Explanation: u&p?}HGH\x.-GH`.n0<`O017 .n0 the ...

View answer
Have you been nice this year?
Accepted answer
5 votes

Pyth 86 bytes Apparently I've been nice this year... jd[z"has been"?qlzl{yPJsKxL+NG@Grz0"nice"+*"very "&!}Jm+*+2d*dd2SJhgs._M-VKtK0"naughty Try it online: Demonstration or Test Suite ...

View answer
A multiplication table for the Cheela
Accepted answer
14 votes

Pyth, 27 * 0.8 = 21.6 VSQsm.[\ 4jkXj*dNQrT99rG1SQ Try it online: Demonstration Explanation: VSQsm.[\ 4jkXj*dNQrT99rG1SQ implicit: Q = input number VSQ for N in [1, 2, .....

View answer
Santa's Decision
Accepted answer
4 votes

Pyth, 68 bytes - 25% = 51 V.zI-hA.g}\:kcNdY=+YGjd+G@c"needs more data coal toys"b._-Fmsecd\:SH Try it online: Demonstration

View answer
Motzkin Numbers
8 votes

Pyth, 15 bytes Ls*V+KyMb1+t_K1 This defines a function y. Try it online: Demonstration Explanation: Let y[n] be the n-th Motzkin Number. I calculate y[n] with the formula y[n] = dot product of (...

View answer
Serial voting detection
Accepted answer
6 votes

Pyth, 22 bytes pM_srSsfttTtMM.gkcz2 8 Try it online: Demonstration or Test Suite Explanation: pM_srSsfttTtMM.gkcz2 8 cz2 chop the input into pairs .gk ...

View answer
Most logical rectangle formula from numbers
1 votes

Pyth, 18 bytes jd[Kf!%QTs@Q2\x/QK Try it online: Demonstration or Test Suite Same idea as Martin's. Finds the first number >= floor(sqrt(n)), that divides n. Explanation: jd[Kf!%QTs@Q2\x/QK ...

View answer
Make a numeric list converter
5 votes

Pyth, 33 bytes rjjezrXwJ"<>[] {}(),;"d7@c6JChz6 Try it online: Demonstration or Test Suite Explanation: J"<>[] {}(),;" assign this string to J rjjezrXwJd7@c6JChz6 implicit: z = ...

View answer
Product over exclusive and inclusive ranges
3 votes

Pyth, 20 bytes *FPW}\)ztW}\(z}FvtPz Try it online: Demonstration or Test Suite Explanation: *FPW}\)ztW}\(z}FvtPz implicit: z = input string tPz remove the first and last ...

View answer
Remove more than n consecutive vowels from input string
Accepted answer
5 votes

Pyth, 21 bytes sfg3=Z&}rT0"aeiou"hZz Try it online: Demonstration or Test Suite Explanation: I iterate through all chars and keep track of how many vowels I passed using a counter. Every time ...

View answer
Find the sets of sums
Accepted answer
8 votes

Pyth, 14 bytes V^SQEIqsNQj\,N Try it online: Demonstration or Test Suite Explanation: V^SQEIqsNQj\,N implicit: Q = first input number SQ create the list [1, 2, ..., Q] E ...

View answer
Seven's Cycle Sum Sequence
Accepted answer
1 votes

Pyth, 14 bytes s.uieM*R7jNTTQ Not sure, why everybody determines the result by looking at patterns in the numbers. Simply doing the process, calculating all numbers of the circle and summing them up ...

View answer
1 2
3
4 5
11