« first day (2346 days earlier)      last day (2496 days later) » 

11:40 AM
@LeakyNun hi
I am probably being dumb butI dno
I don't see why it is a dupe?
 
@Lembik tell me why it isn't
 
take the example in my question with Z_7
2 is coprime to 7. But it doesn't answer my question
 
why not
 
2 is not a generator for Z_7
 
1
Q: Identify the direction of lines in an ASCII-figure

Stewie GriffinChallenge: Take a rectangular figure consisting of the two characters # and (whitespace, ASCII-32), and identify which direction the lines are. The options are: 'Vertical', 'Horizontal', 'Left Diagonal' and 'Right Diagonal'. Input: The input will be a figure of size n-by-m where 5 <= m,n <= 2...

0
Q: Find a number which generates all the integers mod q

LembikConsider the integers modulo q where q is prime, a generator is any integer 1 < x < q so that x^1, x^2, ..., x^(q-1) covers all q-1 of the integers between 1 and q-1. For example, consider the integers modulo 7 (which we write as Z_7). Then 3, 3^2 mod 7 = 2, 3^3 = 27 mod 7 = 6, 3^4 = 81 mod 7 ...

 
11:41 AM
if we try it we get 2, 4 and 1
that's it
 
right
 
so I don't see the connection to the coprime question
 
I've reopened it, sorry.
 
please feel free to upvote as a penance :) (that's a joke )
no problem at all
I love how active PPCG is
I am also pleased with this new code-golf trick someone taught me
where you just ask them to complete some task with their code to stop really slow solutions
what is U_n?
@LeakyNun re: your comment
 
I'm wrong, U_n is cyclic
U_n is the units in ring Z_n
 
11:46 AM
ah ok
you know more number theory than me :)
 
but U_n is not necessarily Z_n \ {0}
point is, it isn't always possible
 
there is always a generator
remember q is prime
 
oops, sorry
that's the third time I'm wrong
 
:)
 
really shouldn't chat while playing league
 
11:51 AM
:)
 
12:04 PM
yawn Yesterday I had to navigate some web pages written in German
Then I had to try to glean information from a livestream where the guy was speaking Japanese
(neither of which I know myself)
 
hi @Mr.Xcoder
 
@Lembik To avoid memory and time-inefficient untestable solutions?
@Lembik Like, you cannot test them in reasonable time?
 
@Mr.Xcoder basically it's an alternative way of saying you want reasonably efficient solutions only
 
@Lembik first of all you have said you don't care how long our solution is...so why even do the test at all then?
 
@EriktheOutgolfer the statement is meant to be read as , the only restriction on performance is that you must have run it to completion on X
 
12:06 PM
@Lembik I suggest bringing the limit a bit lower, though. Do you really need to handle that large numbers? If so, consider turning it into .
 
@Lembik that contradicts the part you don't care about speed though
 
if you go down the route of restricted complexity it's very hard to specify "shouldn't run too slowly"
@EriktheOutgolfer I can rephrase if you think it's confusing
 
Most of the languages (including some Python methods) run out of memory when at half of that number...
 
done
@Mr.Xcoder there I think is a confusion
@Mr.Xcoder they only run out of memory if you use a very naive method
 
@Lembik No confusion.
@Lembik Some
 
12:08 PM
a more efficient method wouldn't run out of memory
 
@Lembik well, what if I test it on a theoretical supercomputer which can do the testcase in under 1s?
 
...and I'm once more out of things to do
 
so I am just excluding those methods which are too slow and/or too memory inefficient
that's all
@EriktheOutgolfer you need to have actually run it to completion
 
@LegionMammal978 There are 2 new challenges you can solve...
 
@Lembik let's say I actually have such a computer...and then I do run the testcase in under 1s, is my answer then eligible?
 
12:10 PM
@EriktheOutgolfer I deliberately set the test case so that it is very unlikely any supercomputer would run to completion with the obvious naive solution
 
@Mr.Xcoder But the first one disallows built-ins, and the second one is string processing
 
@EriktheOutgolfer yes. But that just means I screwed up. Which I hope I didn't
 
@LegionMammal978 Why would that be a problem? Do you like Mathematica? If so, I agree.
 
@EriktheOutgolfer for example, if you find a sort of fast solution which would only run to completion on a million dollar computer but not on a 1000 dollar one, then my question is not so good
 
@Lembik well did you use sandbox? that could've been addressed there in first place, in case you think you "screwed up" or something
 
12:11 PM
however I doubt such a thing exists
@EriktheOutgolfer I don't think I have screwed up :)
but you are right that sandboxing is always a good idea
except that typically no one comments on sandboxed questions
well actually.. typically one or two people do
 
call for feedback here, it may help
 
@Lembik I really suggest turning it into . Not because of that requirement but it's also much more interesting and suited for the task.
 
codegolf.stackexchange.com/questions/129359/… has the same sort of restriction
 
@EriktheOutgolfer Sadly, that's usually the only way to get help :/ chat
 
which didn't upset anybody
@Mr.Xcoder fastest-code has other progblems
a) C wins which is boring
 
12:13 PM
fastest-algorithm then
 
b) I have to run everyone's code
 
You cannot test all of them or don't want to...
 
@EriktheOutgolfer that has other problems
how do you measure the speed of an algorithm
 
timeit :) (joke)
 
and I don't care if it takes 1 second or an hour
 
12:13 PM
Well, then Python is mine >_>
 
I just don't want it to take 2^100 years
and 2^100 bytes
 
@Lembik Fine :)
 
thanks :)
 
@Lembik you mean memory bytes?
 
12:14 PM
yes
 
@Lembik I'll try to solve it so, bye!
 
thanks!
 
@Lembik one question, but I think it's what you want
 
@Lembik you might need to clarify that ^ is exponentiation in your challenge
 
@StepHen only sort of .
 
12:16 PM
@Lembik well, the challenge is as of now, so I'd try to write as terse code as possible...
 
@KritixiLithos will do
@EriktheOutgolfer thanks... if you can do it so that it actually completes you are the winner
 
and maybe add few more testcases
and some testcases with larger inputs
 
@KritixiLithos I need some code to do that :)
@KritixiLithos but yes
 
@Lembik Well, you should implement your own solution before you make us do it then :P
 
@StepHen true!
 
12:18 PM
otherwise how do you prove it's possible at all?
 
@Lembik You have to output x, which is the generator, right?
Like, in that example 3?
 
@EriktheOutgolfer I do know how to do it
@Mr.Xcoder yes
@EriktheOutgolfer or at least one way to do it I should say
normally someone on PPCG comes up with something I hadn't thought of too
 
@Lembik so...you can implement it yourself? well, include that in the post then so that we know it's certainly possible
I mean like a notice e.g. "I have tried to do it and I've concluded it's possible" or something
 
@EriktheOutgolfer yes I could and should and will as soon as I have time. I won't include in the question though
 
@Lembik ^^
 
12:20 PM
as that reduces the challenge and some people really like to solve things themselves
@EriktheOutgolfer not everyone likes things spoon fed to them :)
(that was a joke.. no offense intended)
 
of course you wouldn't include a reference implementation
just the notice
 
16 bytes!!
that's great
 
In Python, why is [1,2,4] not in [1,2,4]?
 
ooh it seems the proof arrived by itself :P...conclusion: it's possible
 
@MartinEnder do you know how to display the rectangle when it's padded with spaces? It's a rectange in the edit-window, but SE trims the spaces away when displaying it.
 
12:22 PM
@Mr.Xcoder what are the elements of [1,2,4]?
 
Must I add a dummy character in the end of the line?
 
@Mr.Xcoder is your house inside your house?
is your shoe in your shoe? :)
 
@Lembik Yes.
 
@Mr.Xcoder The only things in [1, 2, 4] are 1, 2 and 4. in does not test for subsets, only elements
 
@StewieGriffin try using <pre><code>...</code></pre> instead of a markdown code block
 
12:23 PM
@trichoplax Then, how to check if a list is equal or included to/in another list?
 
Arg,,, crying daughter... Got to go... Will fix it later...
 
Solved
 
Feel free to make the edit.
gtg
 
@Mr.Xcoder You can use sets (convert both lists to sets then you can test if one is a subset of the other)
That won't cover duplication though, if you want [1,2,2] to not count as in [1,2,4]
 
@trichoplax Would {1,2,4} be a subset of {1,2,4}?
@trichoplax I have another approach anyway
 
12:27 PM
@isaacg In your explanation, by "mod" do you mean something else other than %?
 
@Lembik Please, check the validity of this answer (not yet golfed): tio.run/…
 
@StewieGriffin doesn't seem to help either
 
But Ignore the huge test case, will be fixed soon
 
@KritixiLithos No, they're the same thing. mod is the way you write it in math
 
@Mr.Xcoder issubset() or equivalently <= will return true if a subset or equal. If you don't want to include equality, < will only return true for a strict subset
 
12:28 PM
@trichoplax Sets will work because there will be no dupes. Thanks for the idea
 
so wouldn't 1 mod n, where n is greater than 1, always return 1?
unless I'm misunderstanding something here
 
@KritixiLithos It always returns 1, if n > 1
 
@Mr.Xcoder It's never going to terminate on the test case
as you say
 
Will change the algorithm completely. Just wanted to know if this gives good results
For the small test cases
 
looks good
 
12:35 PM
oh, I understand your answer now
 
Sorry, my computer exhausted all the memory because I forgot to stop the process on the last test case. I now have 22 MB left :/
And I think it starts flaming inside :/
So I really have to go.
 
oops
 
It nearly caught on fire... I deleted most of the caches, but I am afraid I will delete something improtant if I keep doing this
What should I do :~
 
restart?
 
That is crappy
 
12:40 PM
isn't it only eating up your RAM?
 
I stopped the program
And now I have 5 GB
Lol
It resulted in a SIGKILL thogh
 
That's standard - all the memory is reclaimed when the program exits
 
@isaacg I know, but I really didn't think it took 5 GB
 
genuine question: is that eaten-up memory a part of the RAM?
 
@KritixiLithos Yes.
 
12:42 PM
Yep
Ninja'd
I am relieved 😌
 
@isaacg nice answer by the way
 
Thanks!
 
@Lembik Outstanding answer, I would say
 
@isaacg and you inspired codegolf.stackexchange.com/a/129444/9206 too
does Jelly have builtin factorization too?
if it does, we are in trouble :)
 
@Lembik And then we are waiting for 05AB1E I suppose...
 
12:48 PM
if that has factorization.. I have no idea!
 
I'd do Sinusoidal ASCII-art animated text with SOGL, but no interpreter has live output :/
 
@Okx it can be done splitting the lambdas (in Python), so having two separate functions in 46 bytes. I am just too lazy to suggest that...
 
1:59 PM
now we have two pinned message >_>
does nobody get the fact that those messages don't help?
 
@totallyhuman They are pinned because of people not being polite to each other, in the absence of consequences. I agree they don't help, but please do not open the subject again. By not giving attention to those facts, we might be able to solve the problem.
 
fair enough
 
2:57 PM
0
Q: Repeated reciprocal

Solomon UckoWhat you need to do is create a function/program that takes a decimal as input, and outputs the result of repeatedly taking the reciprocal of the fractional part of the number, until the number becomes an integer. Test cases: 0 0.1 -> 10 0.2 -> 5 0.3 -> 3.3... -> 0.3... -> 3 0.4 -> 2.5 -> 0.5 ->

 
Why does this have 5 downvotes?:
-5
A: Repeated reciprocal

Solomon UckoPython, 50 bytes, or 39 bytes with round-off error def f(a):b=a%1;return f(1/b)if b else a To fix round-off error: def f(a):a=round(a);b=a%1;return f(1/b)if b else a

 
@Adnan because it was posted exactly when the question was asked
in other words, unfair starting point.
I'm speaking of myself of course, I don't know what the other 4 downvoters are thinking.
 
i agree
 
you downvoters might want to comment on that post, the OP might not be aware of the reason
 
3:13 PM
TIL 5 != 7
 
@StepHen ?
 
@LeakyNun I had input restriction on my FGITW challenge as 5x4, the gun is 7x4
 
3:26 PM
5
Q: Lets make a triangle

Einkorn EnchanterMost people are familiar with Pascal's triangle. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 Pascal's triangle is a automata where the value of a cell is the sum of the cells to the upper left and upper right. Now we are going to define a similar triangle. Instead of just taking the cells to the...

 
 
1 hour later…
4:26 PM
The last message was posted 1 hour ago.
 
Okx
CMC: Check if a number is a Lynch-Bell number. A number is a Lynch-Bell number if all the digits are unique and the number is divisble by each digit (I have a 6 byte solution myself, I'd like to see the others)
 
@Okx in which language?
 
Okx
My own, of course :P
Neim
 
testcase?
 
Okx
126 -> true
16 -> false
0 can be whatever you want, all 1-9 is true
 
4:39 PM
Jelly, 9 bytes: DµQ⁸%⁼0ṁ$
 
@Okx (n,a=n.digits)->a.some(i->n%i)&&a.unqiue==a
 
Okx
language?
 
@Okx Jelly, 7 bytes: D⁼QȧọDẠ
(might be buggy)
surely valid version: D⁼QȧọD$Ạ
 
@Okx cheese
 
is it swiss cheese
 
4:41 PM
No
 
I think it's cheddar...
 
Okx
@EriktheOutgolfer 55 returns 1
 
surely valid version doesn't
 
Okx
ok
 
4:42 PM
@Downgoat you misspelled unique
 
umm...
22 hours ago, by Mego
Repeatedly starring and unstarring things is still star spam. Cut it out.
 
Btw @Mendeleev did you see that Canada got a giant duck for their 150th anniversary:P
 
Okx
it wasn't star spam it was an accident :P
 
oh...well, I just post it so that if it is star spam it hopefully stops ;)
 
Accidents are fine. It's repetition that is unacceptable.
 
4:48 PM
that sounds like it came straight out of a movie
 
Okx
4:58 PM
should i post is it a lynch-bell number to main?
 
If you'd like a sandbox post reviewed, could we have a link?
 
Okx
no i don't need a sandbox post reviewed
 
yes you always do :P
 
Okx
fein i'll post it to sandbox
 
sandboxing is always a good thing
hmm do we have a challenge to print the periodic table out?
or the ascii table?
that might make for some interesting answers
 
@totallyhuman aw shoot that's been done ;-;
 
@Okx Terribly golfed, but MATL, 15 bytes: tVttu=*48-wZ\mp
 
0
A: Sandbox for Proposed Challenges

OkxIs it a Lynch-Bell number? You will be given a positive number (number > 0) as input. Your task is to check whether it is a Lynch-Bell number or not. A number is a Lynch-Bell number if all of its digits are unique and the number is divisible by each of its digits. In fact, there are actually o...

 
5:45 PM
how hard is it to read a pdf as a sequence of images, one per page? Are there good libraries for this?
I want to ask a pdf challenge :)
But I don't know much about pdf reading libraries
I assume there is a python library for this because there always is :)
 
0
A: Sandbox for Proposed Challenges

Zachary CottonHailstone Sequence The hailstone sequence is defined in the following way: Given a starting value n: if n is less than or equal to one, the sequence terminates if n is even, the rest of the sequence is the hailstone sequence starting at n divided by two if n is odd, the following sequence is t...

 
nobody? Harumph :)
 
6:16 PM
Lembik: you mean pdf rendering?
err @Lembik
 
@CensoredUsername I guess. Is that the same as converting a page of pdf into an image?
 
then yes :)
 
anyway that's pretty damn hard
 
but are there libraries that do it?
everything is easy if it's just a library function call away :)
 
6:17 PM
PDF is a very complex file format, there's only a few implementations available I think
however, pdf is technically a text file format, and extracting images from pdfs programmatically is doable
 
poppler maybe?
@CensoredUsername aha!
 
what do you intend to do for your challenge
 
I want a challenge that just finds which pages contain 2^n . That is $2^n$ in latex as in 2 to the power n
just that
 
so basically a math grep
 
6:19 PM
that is probably doable
would be quite a complex challenge though
 
it's highly unclear to me.. can I give you at test document?
 
you have to properly consider your restrictions
 
@Lembik lemme give you a simple python parser that should be able to parse simple pdfs into a graph
 
ok
it just seems dumb to me that you can't grep for math
 
6:23 PM
well
pdf is hard
usually a lot of internal stuff is base-85 encoded
 
right but all math is in pdf documents!
it's probably not too hard as an image processing task to search for 2^n I was thinking
 
ignore the top function, that was for my specific application, although it kind of shows how it works
 
wow that's long!
what does it do on my trivial test file?
 
as in?
 
6:25 PM
probably cause I coded it against a specific pdf output
 
I tried pdftotext on it which gives no output
 
not sure why it exactly fails
but it should show you how pdf is a pretty hard file format to deal with
 
ok so maybe it's easier once each page is an image?
 
as long as you restrict what's in the pdf it might be doable
but PDFs can be very complex in how they're built up
 
right.. so..going back to my point :)
 
6:28 PM
essentially pdfs contain an acyclic multiple-linked graph of nodes
 
shall I just forget the pdf part and make it an image processing challenge?
 
probably better
 
ok.. so then I just need to write a challenge to convert each page of a pdf into an image :)
(that was sort of a joke)
there is probably some set of command line tools to do that come to think of it
 
I'd look at pdf.js, probably can use that
outside of that I don't recall any OSS pdf rendering implementations
 
OSS?
open source software?
 
6:35 PM
open source software
 
:)
the command line tool convert can do it for single pages
hmm.. this could make a challenge
 
1
A: Line editor (more text here)

Felix Palmen6502 Assembly (C64, BASIC loader), 5761 bytes 0fOa=49152to50676:rEb:pOa,b:nE:sY49152 1dA162,54,134,1,162,1,134,7,134,8,202,142,0,96,134,251,162,96,134,21,162,128 2dA142,145,2,162,23,142,24,208,162,240,134,20,166,8,169,0,160,253,32,102,194,32 3dA130,195,32,186,195,166,2,240,103,202,202,16,2,162,0...

 
@Christopher turns out ghostscript does the job
 
@Lembik also I was wrong, pdf is actually a cyclic
graph
 
6:50 PM
@CensoredUsername ok.. but my test file ... does this tell you anything about?
 
been digging a bit into it
 
thanks!
 
gimme a bit, almost at the actual contents node
 
sounds exciting ;)
 
0
A: Sandbox for Proposed Challenges

LembikConvert each page of a PDF into an image The task is, given an input PDF file specified and given in any convenient way, to output one bitmapped file per PDF page which renders that page. The output should be at a reasonable resolution at least 300dpi but can be in any bitmap format you like. ...

 
looks like it used deflate on the actual contents
 
@Christopher mno?
@CensoredUsername what is deflate?
sounds like a decompression algorithm
 
yeah, it's more commonly known as zlib
anyway after somewhat fixing my parser (pastebin.com/i11Vdz1S) I basically did: zlib.decompress(pdf_parser.parse(file).trailer.d.get_key(b"Root").values[0].get‌​_key(b"Pages").values[0].get_key(b"Kids").values[0].values[0].get_key(b"Contents"‌​).values[1].bytes)
which gives b'BT\n/F15 10.9091 Tf 142.735 701.148 Td [(2)]TJ/F19 7.9701 Tf 5.454 3.958 Td [(n)]TJ/F15 10.9091 Tf 154.209 -562.265 Td [(1)]TJ\nET\n'
 
hmmm
so what is that?
it there just an image for the 2^n?
 
nope
look in there, for the [(2)], the [(n)]
also the [(1)] for the page number
()'s are pdf's string literals
no idea where the ^ went though
oh wait that's not in there
well there you have it
 
7:06 PM
Question: is it good idea to have an unless-like Ruby-esque statement in C-style language
 
I think F15 means "absolute character position" while F19 is relative to the previous one
i.e. the n is defined relative to the 2 there
but no there's no image there, it's just "put character a at scale z at x, y"
with a certain font that' I'm not sure of
 
oh so can you see the 2 and the n in there?
oh right!
I see them
 
F15 and F19 are names for the font blobs in the pdf
 
hmm.. interesting
so maybe it is possible?
 
BT/TJ are probably position instructions then
well it is, but I really don't think this'd make for a good code-golf unless you really define the structure of your pdf well
writing your own pdf parser is an exercise in masochism
 
7:10 PM
right
:)
 
because >adobe >public standards
 
understood
I was hoping there would be good libraries people could use
 
also, there are infinitely many ways to encode similar looking pdfs so image analysis of rendered pdfs is probably the only way to get the best results
(unless you can hook into the pdf renderer and intercept calls to string drawing routines
I'd just like to remind you that correct rendering of the pdf file format requires you to embed a javascript interpreter in your pdf rendere
 
^ would buy that vase
 
^^ would like to see someone make that vase without it dying
 
7:20 PM
wait, that's already been proven
 
7:33 PM
> Transform Error: Annotation primitive expected exactly 1 args; you provided 1 arguments.
._.
vsl> let c: Int64 = a
ReferenceError: Can't find variable: e
ok this isn't better
 
0
Q: Why this code generates garbage when subtracting 0.01 from 0.01?

pedicoqSo, I was writing a code to calculate the change in notes and coins given the user input. I know it isn't the most efficient way to do it, but I stepped into a very curious error. When the program subtracts 0.01 from 0.01 I get 1.81764e-14 or something like that instead of zero. Does anyone have ...

 
@NewMainPosts Already nuked
 
7:49 PM
Next time someone asks me why I use Linux, I'll use this as one of the reasons:
Seriously, after using Windows for a while, package management is really nice
Much better than wizards
 

« first day (2346 days earlier)      last day (2496 days later) »