@NickClifford Pardon me for not understanding, but what exactly do you mean? Do you want to match the first and third as in abc"abc"abc, but not the second (or something similar)?
Posted the domino challenge. If I don't get Hero of Time for this I will be extremely disappointed in the SE team
Ah shoot, I missed the "7:00 pm" requirement. nevermind...
Ungolf my tinylisp code
code-golf parsing whitespace lisp balanced-string
I like golfing in tinylisp:
(d M(q((x)(i x(i(disp x)0(M x))0
But I also like posting explanations with nicely formatted code:
(d M
(q
((x)
(i x
(i (disp x) 0 (M x))
0))))
Can you help me generate the u...
Challenge
Given two digits 0-9 as input, output a domino (from the double-nine domino set) with these number of pips (dots) on the two faces. The ten possible faces look like this (separated by pipes):
| | o| o|o o|o o|o o o|o o o|o o o|o o o
| o | | o | | o...
> Don't use The Nineteenth Byte as a dumping ground for your thoughts or actions. Consider whether a topic would be relevant to others before talking about it. We're here to have discussions, not to listen to someone's stream of consciousness.
CMC: Output the number of minutes it is until it is exactly midnight in any time zone on this page. You may optionally take the current time as input. The output may be rounded either up or down, at your discretion.
Anonymous
Alternate wording: output how many minutes you should wait before posting if you want Hero of Time ASAP.
In field theory, a primitive element of a finite field GF(q) is a generator of the multiplicative group of the field. In other words,
α
∈
G
F
(
q
)
{\displaystyle \alpha \in \mathrm {GF} (q)}
is called a primitive element if it is a primitive (q−1)th root of unity in GF(q); this means that all the non-zero elements of
G
F
(
q
)
{\displaystyle \mathrm {GF} (q)}
can be written as
...
Pick an element and compute its powers. If these cover all nonzero elements, you have found a primitive element. Otherwise pick an element that you did not cover and start over again.
> The structure theorem of finite abelian groups implies that this multiplicative group is cyclic, that is, all non-zero elements are powers of a single element.
@WheatWizard I was just trying to remember if there's a better way to determine the primitives than brute force. You can calculate how many there are efficiently (en.wikipedia.org/wiki/Primitive_element_(finite_field))
@WheatWizard I see some indication that maybe the difficulty is in finding a primitive element for Z_p with p so large that (p-1) can't be factored. There's an implication that with the factorization of (p-1) in hand, there's a fast way to find the primitives. I don't know what it is
I think it might apply to what you're doing. I didn't read it carefully enough to say for sure, but it's written at a very convenient level. I'll stop trying to help, but let me know if you find a better method?
I got an idea for challenge, and I thought that it would be cool to name it "The ting goes [skrrrahh in BF]", but it's gotta be quite long... Anybody got a better idea? xD
The ting goes >+++.--------.+++++++...<+.+++++++..!
popularity-contest kolmogorov-complexity
The title is actually valid BF code, but only if you initialize the tape with hex 50 60. Well... not even sure if that's correct.
One of the latest memes is the song by Big Shaq, "Mans not hot". When...
@wizzwizz4 char *memory = malloc(memory_size); is ok if memory_size is the correct size in bytes srand((unsigned int)(size_t)(void *)memory); this is wrong because srand() initialize the random function with a seed : One can write srand(1) (and call rand() for obtain the random value ) or srand(5000) for to have a fixed sequence or srand(time(0)) for have one not fixed sequence
char *memory = malloc(99); srand((int)memory); with this even if malloc(99) return 0 (fail) it initialized srand(0); but what about (int) memory is out of the integer range allow as argument in srand()?
@Mego There might be some garbage data left in memory, but in practice it's zeroed.
Anonymous
@wizzwizz4 Not true. It's OS-dependent. I believe MSVC doesn't zero the memory by default. Either way, it's not UB - the standard specifies exactly what happens.
correct me if i'm wrong, but a highly specific challenge asking for something to be turned into a one-liner only within a specific language is not on topic on PPCG, correct?
Introduction
This is a follow-up of this challenge where you're taking the role of that person's evil twin. Being evil you don't want to maximize your share, but rather be as unfair as possible and you're not going to make it too obvious, that's why you came up with the following scheme:
You're...
If the kernel doesn't, there's probably lots of other stuff about the PID that it's keeping that it doesn't need to, so freeing memory is only delaying the inevitable drought (the end result of a leak).
In this challenge we learned a way to encode every positive integer using factor trees.
Here is how it works:
The empty string has value of 1.
(S) where S is any expression with a value of S evaluates to the Sth prime.
AB where A and B are arbirary expressions with values of A and B respective...
This has no practical purpose but it could be fun to golf.
Challenge
Given a number n,
Count the amount of each digit in n and add 1 to each count
Take the prime factorization of n
Count the amount of each digit in the prime factorization of n, without including duplicate primes
Create a new ...
Input: An integer N which represents the polygon's vertices and a list of their x and y coordinates.
Expected output: The smallest difference possible between the area of the(not necessarily convex) polygon and the triangle containing it. If there is no such triangle print -1.
Christmas is coming up, and this year you have been charged with organizing your family's christmas get-together. You have a list of foods you want be there, but before you assign foods to people, you need to know who's coming. So...
Challenge
Given an input of relative's names separated by com...
@BruceForte @Emigna @user202729 @IanH. I'm removing the community wiki answer to Find the longest word in an array. Please repost your individual solutions.
Festivus is a secular holiday celebrated on December 23 as an alternative to the pressures and commercialism of the Christmas season. Originally a family tradition of scriptwriter Dan O'Keefe, who worked on the American sitcom Seinfeld, Festivus entered popular culture after it was made the focus of the 1997 episode "The Strike."
The non-commercial holiday's celebration, as depicted on Seinfeld, occurs on December 23 and includes a Festivus dinner, an unadorned aluminum Festivus pole, practices such as the "Airing of Grievances" and "Feats of Strength," and the labeling of easily explainable events...
If you google search "festivus" there is a festivus pole on the left of the results page.
You have been given N piles of coins. You have decided to divide each of those B1, B2...BN piles among separate groups of people. The amount of people receiving coins has to be a prime number and the amount of money given to each person must be different in each pile.
Input: N, B1, B2...BN(The a...