6:02 PM

1

A Harshad number is a number that is divisible by the sum of its digits. This is obviously dependent on what base the integer is written in. Base 10 Harshad numbers are sequence A005349 in the OEIS. Your Task: Write a program or function that determines whether a given integer is a Harshad ...

@DJMcMayhem How?

Why 16 --- because you're a goner. (G-16 in base representation)

@DJMcMayhem 10848 LOC APL (counting only .dyalog;.css;.txt;.mipage)

6:23 PM

HERESY! THAT ISN'T XKCD!
8

what should the function to set the current grid space to a certain character do if it's at the end of the file

Format the hard drive. That's standard practice for undefined behaviour, right?
4

@Okx Nope. Not goin' there.

i spent ages making it ;-;

@Okx Why JS?

wait
i inspired that didn't i

why not

6:33 PM
@Okx CSS is enough.

it's not TC

@Okx Yes it is. (if hand-cranking is ok)

not quite
almost

May 23 at 11:15, by Mayube
lies, slander, heresy

Stop arguing. JSSS was suprerior.

6:34 PM
but tis not quite .com is it

@Zacharý So what?

JS + CSS basically.
And my main point: stop arguing.

Anyone else getting tired of the `Is it a ___ number` golfs?
5

dennis got out-golfed by xnor
:o

6:37 PM

@tuskiomi some of them are interesting

@totallyhuman and it's not that surprising
dennis is good, but so is xnor

yeah but the meme D:

>_>

The monotony of comparing against a formula is very offputting. and it seems like there's a number type of the day thing going around. we could have one challenge for every OEIS.

6:37 PM
also i need to implement a to base function

One does not simply outgolf Dennis.

anyone got a good way to convert `n` to base `k` in python?

@Phoenix is that a tiny rick
I think that's a tiny rick

I do

and i might be able to tie jelly

6:39 PM
@Riker So do I

hey I made a Hello World program in Paintbrush
`sH>se>sl>sl>so>s,>s >sW>so>sr>sl>sd>s!`

jelly code page?

yes
as you can see I am uncreative
anyfix used that codepage too lol

!google python convert integer to base
ugh i keep forgetting

@totallyhuman From SO:
```def numberToBase(n, b):
if n == 0:
return [0]
digits = []
while n:
digits.append(int(n % b))
n /= b
return digits[::-1]```

6:40 PM
oo you use duckduckgo?

@tuskiomi There's nothing wrong when they're an interesting property, but I wish people would skip posting ones which are just about base conversion, primality testing, or linear recurrences.

o :(

i frequent another chat room that has a bot
that responds to a message starting with `!google <term>` with `google.com/search?q=<term>`
@HyperNeutrino look man i actually wanna find stuff when i search

@tuskiomi CMC: Check whether a number is a number

6:42 PM
@PeterTaylor I suppose the nominal option is to downvote the monotonous ones. That's not much of a help, though.

@totallyhuman I really think we should have a TIO bot here.

@cairdcoinheringaahing :-)

@cairdcoinheringaahing Huh, like all the chars are digits, or even `123.456E789`?

@totallyhuman :(

@totallyhuman You can use `format(n, 'x')` for hexadecimal, `format(n,'d') for decimal, with `'b'` for binary and `'o'` for octal

6:43 PM
i want one for all bases
@Phoenix oh thanks

No, sorry

@Adám just check if its a number

@totallyhuman Although, here's a faster version:
```import string
digs = string.digits + string.letters

def int2base(x, base):
if x < 0:
sign = -1
elif x == 0:
return digs[0]
else:
sign = 1

x *= sign
digits = []

while x:
digits.append(digs[x % base])
x /= base

if sign < 0:
digits.append('-')

digits.reverse()

return ''.join(digits)```

@cairdcoinheringaahing Python: `lambda n:1` (because a number must be a number)

`5 => true, a => false, 10a => true`

6:43 PM
Apparantly

@cairdcoinheringaahing APL: 1

@LeakyNun How does that work with duck typing? I thought the input was given as a string

wait any reason to return a list instead of the sum of it

@LeakyNun lol

@musicman523 a number must be a number

6:44 PM
^

@LeakyNun `print(1)` -3 bytes

@musicman523 it just returns 1 for everything

@totallyhuman Yeah, I think it isn't a very well written function.

@LeakyNun Not all strings are numbers, unfortunately

@musicman523 but the question is "check if a number is a number"

6:44 PM

> if a number is a number

@totallyhuman probably would be shorter with numpy: `numpy.base_repr()`

@cairdcoinheringaahing APL: `⍬≡0∘⍴`

2 mins ago, by caird coinheringaahing
@tuskiomi CMC: Check whether a number is a number

Well that's just silly

6:45 PM
@musicman523 thats the point

I still have a shorter answer though
Python, 3 bytes: `int`

@musicman523 doesn't work for `0.1`

@musicman523 Python REPL: 1

`float` then

6:46 PM
@totallyhuman `import ``gmpy2``;gmpy2.digits(n, base)` works.

You abuse the meta consensus with error throwing

@LeakyNun heh

@musicman523 doesn't work for `1+2i`

@LeakyNun that's not a number in MY domain :P

6:47 PM
Please remember that if you find something inappropriate and would like to have it removed, you may be better served by using the "flag for moderator attention" and including an explanation for why you found it inappropriate. It's a pretty safe bet that a chat message with 6 stars is unlikely to be deleted unless it's overtly problematic. Thanks!

@LeakyNun first of all it's `1+2j`

`complex` then :P

I should create an adblock fliter that filterse these questions out! :P

@musicman523 Sort of is ... (MY - the programming language :p)

6:47 PM
@HyperNeutrino is 1+2i a number?

@LeakyNun yes

@HyperNeutrino exactly

@Catija what happened?

it's a complex number which I think is a number lol

@HyperNeutrino you're a complex number

6:48 PM
@musicman523 r00d :(

@musicman523 Welcome to primary school!

Haha!

@Phoenix uhm what's `gmpy2`?

@musicman523 oshit sick burn

@Catija Wrong chat room?

6:48 PM
@EriktheOutgolfer Someone used a generic spam/offensive flag on a message in here.
@Mr.Xcoder Definitely not.

but I didn't see any blue

oh right 10k+ can all see flags

@EriktheOutgolfer It was a few minutes ago.

@Catija Popcorn SE says nothing?

6:49 PM
was wondering why erik could see flag

@EriktheOutgolfer yep it happened

i'm not adding some random dependency >_>

@HyperNeutrino How is the new language going

@Mr.Xcoder eh haven't worked on it in a whole 5 minutes
wait is it 10k on highest, 10k on parent, or 10k network to see flags?

Wow

6:50 PM
@HyperNeutrino, were you the one with the whole page for languages?

@Zacharý which page?

@Zacharý thats me

@HyperNeutrino on parent I think

@cairdcoinheringaahing Thanks.

ah ok

6:51 PM
@HyperNeutrino network

Yep, sorry

oh hm.
then I could theoretically join 20 sites and use assoc bonus to get to 10k pretty quickly
don't see a point in that though :P

@HyperNeutrino you just found the flaw in your plan

what

But network rep only includes sites you're over 200
I though

6:52 PM
ah ok

wait i have a better idea for base conversion
use jelly's function

@Zacharý this?

lol

@totallyhuman yes +1

Yeah, that.

6:53 PM
@totallyhuman you can't write an interpreter for your new language in Jelly!

@cairdcoinheringaahing It's possible, just don't do it.

no but i can take inspiration from the jelly code (which is written in python)

@totallyhuman The first reference to it is a link

or use the SO post that Phoenix gave you

@Zacharý until you write a brainfuck one in Jelly, at least

6:54 PM
but that would return a string

`gmpy2` is written in C, so it's significantly faster.

and i need to be able to do integer operations on it

@totallyhuman Python, 3 bytes: `int`

```def to_base(integer, base, bijective = False):
if integer == 0:
return [0] * (not bijective)
if bijective:
base = abs(base)
if base == 0:
return [integer]
if base == -1:
digits = [1, 0] * abs(integer)
return digits[:-1] if integer > 0 else digits
sign = -1 if integer < 0 and base > 0 else 1
integer *= sign
if base == 1:
return [sign] * integer
digits = []
while integer:
integer -= bijective
integer, digit = divmod(integer, base)
digit += bijective
if digit < 0:
integer += 1```
@cairdcoinheringaahing it has other characters :P
ok so jelly's version is slightly complicated...

CMC: Make a BF interpreter

6:56 PM
I will offer 4x500 rep bounties to the first person who makes a Jelly interpreter in brainfuck

@totallyhuman Just add a `gmpy2` dependency.

@cairdcoinheringaahing i wonder if that's even possible lol (i mean of course it theoretically is)

@HyperNeutrino a Blue Flower interpreter?

6:57 PM
@HyperNeutrino Since it is Turing Complete, anything is possible... Remember we have Dennis around!

@Mr.Xcoder lol true

0

Background Inspired by this chat message, a "___ number" is any word used to solve a crossword clue containing the phrase "___ number" according to this crossword solver as of the posting of this challenge. The words are: opus, atomic, any, inat, picka, were, potion, dida, doesa, aleph, octa...

oh yeah speaking of which I wonder if MD XF is ever going to become active sometime in the future
but yay

@HyperNeutrino like Howard?

6:59 PM
alright fine i'll add a numpy dependency

oh hm interesting

My BF interpreter - you just have to make the lenguage program that it wants and then execute that

might use numpy for other stuff anyways

like Alex? xD
also use sympy

@musicman523 Sorry, that challenge is awful 😕

7:00 PM
I think Alex A. has gone AWOL

@cairdcoinheringaahing reading that is awkward because I'm also Alex lol

@HyperNeutrino does sympy have base conversion?

@HyperNeutrino coughs

@totallyhuman I don't think so
just use it because then no fp error
@cairdcoinheringaahing ?
rip the challenge

(tell no-one but glances I edited the message!)

7:02 PM
oh
I didn't notice
lol

Thanks for removing it!

@Mr.Xcoder savage
@totallyhuman try this in Jelly
plus no existing answer so no cheats!

i don't know how to do anything in jelly yet
:P

Nor do I

I just write it in Python and use `ŒV`
2

7:05 PM
@totallyhuman then you should train jelly...that is if you have any free time

I think learning both Pyth and Jelly at the same time is not benefficial

@EriktheOutgolfer stop advertising SE on SE!

@cairdcoinheringaahing that's... not how any of this works

7:06 PM
I really need to stop making jokes that only I understand...
Did I kill the room?

"Free time" and SE are antonyms
8

> Silence is okay.

@totallyhuman yeah but it just feels wrong after you don't say something like bye

Bye
Gtg
And Sya

@Mr.Xcoder bye!

7:09 PM
Are the most frequent messages on SE

bye

I don't leave @cairdcoinheringaahing
Don't kill it!

@Mr.Xcoder <.> you lied to me!

new meta post coming soon

7:09 PM
*sandbox

@HyperNeutrino SB?

@Mr.Xcoder ninja'd
but yes

Ah ninja'd!

and I meant new SB post by feeds

@Mr.Xcoder ^^^^^

7:10 PM
@EriktheOutgolfer is that your most common message?

Ninja'd again

Stop it!

uhm
no "Stop it!" is not starworthy
dear lord

7:10 PM
don't mention it...

@totallyhuman star spammer on the loose

OH NO STAR ABUSE AGAIN

Jul 1 at 18:13, by Mego
Repeatedly starring and unstarring things is still star spam. Cut it out.
It doesn't matter that it's not starred anymore.

You know I bet whoever is starring those things can see the starboard
and doesn't care

7:11 PM
so reposting that

63

As a compliment or alternative* to not refunding cancelled stars, it'd be nice if chat would auto-raise a flag identifying someone starring n items in x minutes, or at least provide a list of unusually active starrers that could be consulted when there was a problem. While star-spam is fairly lo...

isn't actually doing anything

Please: whoever is doing that stop it.

Just stop

Stop!

7:12 PM
guys

4

just stop bringing attention to it

telling people to stop 3 times in a row won't change anything...

I reckon its actually Mego, pretending to be someone else

7:12 PM
@cairdcoinheringaahing What now?

can we move the last page of messages to the trash

don't underestimate penguins
7

Mego is doing all the starring

@Poke Good idea

uhm no.

7:13 PM
oh no now erik's message is gonna be on the starboard

I highly doubt that.

@cairdcoinheringaahing Who is he staring at?

@cairdcoinheringaahing he isn't 100%

Besides please don't say that anyway.

do you people realize that you're feeding the trolls

7:13 PM
he's not even in here rn

Let's boycott TNB for the next ~3 seconds

> pretending to be someone else

Hah, teamspirit.js is reporting a score of 20/0

7:14 PM
I'm going to go try to wait out the spam.

suggestion: don't talk! the spammer will be fed up and stop

I'm going to Jelly Hypertraining for some peace and quiet!

jeez

Let's change it: what is the shortest way to get the divisors of a number in Pyth?

7:15 PM
The problem is that few people know Pyth

@Mr.Xcoder I solved a problem about divisors without explicitly finding the divisors

Few? I highly doubt that!
@LeakyNun The task is to get the divisors

3

Pyth, 6 bytes *Fs{yP Test suite.

No, a list of divisors is needed
(Self-challenge)

@Mr.Xcoder just remove the `P`

7:17 PM
@cairdcoinheringaahing huh?
it's not jelly

@cairdcoinheringaahing no, that isn't how it works

just a guess

`*F` is the product
1 min ago, by Leaky Nun
@Mr.Xcoder I solved a problem about divisors without explicitly finding the divisors
I did say without explicitly finding the divisors

K, fine

question: does sympy support complex numbers?

7:19 PM
@Mr.Xcoder 6 bytes: `f!%QTS`

@HyperNeutrino Yes

oo yay

Python supports complex numbers by itself, like `1+2j`

but does sympy have a representation of them
like there's `sympy.Rational`
and `sympy.Integer`, and `sympy.Zero` and `sympy.One` for example

@Mr.Xcoder 5 bytes: `*M{yP`
the `M` here is different, mind you

7:20 PM
Guys
Just use Mathematica

Just use Assembly

not sure how using mathematica is in pyth...

`sympy.core.numbers.ImaginaryUnit`is what sympy uses.

oh ok
so how would I use that
or actually nah ascii-art programs aren't going to need those
they'd be too much of a pain to use anyway
I don't think using sympy is even necessary for an ascii-art lang

Why did you think it was?

7:23 PM
I didn't want fp errors

Just write a language that implicitly uses rationals as the number system, then write the ascii-art language in that language

0

Is it a ____ number? code-golf number Inspired by this chat message, this is a challenge about determining if a number is a ___ number for some specification. Challenge Given the ID to an open PPCG question about "Is it a ___ number?" and a number, your program should determine whether or not ...

@musicman523 So... basically Ruby except you redefine `/` to give you rationals?

@Zacharý Does Ruby use rationals by default? I don't know Ruby

7:34 PM
Goes up to base 62, does not support unary.

@musicman523 I did say except. Ruby doesn't use rationals by default though.

Why Ruby then?

@LeakyNun Vielen Dank

@Mr.Xcoder kein Problem

7:36 PM
I seem to remember that working for some reason.

0

ASCII reflections in a box You probably all know the Law of Reflection, in this challenge you'll visualize the trajectory of a ball in a box. Task You're given three integer pairs W,H, x,y and dx,dy - the first represents the size of the box, the second the starting position and the third pair...