@ASCII-only I was thinking of introducing a quack keyword that can serve as a sort of implicit-interface. Not sure if good idea or bad since you can just do it with extensions.
e.g. quack StringConvertable { func toString() -> String }
Let's start by re-defining a reflection of a character in a 2-d array of characters:
Given a square 2-d array of characters with distinct lowercase alphabetical letters, define a reflection of a letter in the matrix as swapping it with the character directly across from it through the center ...
Let's start by re-defining a reflection of a character in a 2-d array of characters:
Given a square 2-d array of characters with distinct lowercase alphabetical letters, define a reflection of a letter in the matrix as swapping it with the character directly across from it through the center ...
We're still planning out how badges/rep/voting/etc. would work. feel free to leave any/all feedback/ideas in axtell chatroom: chat.stackexchange.com/rooms/68212/axtell
@WhatWizard definetly, most important thing is ideas, suggestions, and feedback. Though if you'd like to code feel free to come into Axtell chatroom or take a stab at any of the issues: github.com/Axtell/Axtell/issues
@Downgoat Ah, that makes sense. That being said, I'm having trouble reproducing the test case. I haven't tried the other characters but I'm currently getting that the first character for the output should either be 5 or 2 depending on which type of multiplication I'm using.
@Downgoat I tried to get into helping earlier, but work snuck up on me and I have become very busy. Perhaps once finals are over I can take another stab.
Swapping two elements in a vector/matrix is very simple in Octave:
x='abcde';
x([4,1])=x([1,4])
x =
dbcae
Unfortunately, I have yet to find a way to do this inside an anonymous function. While the function below is syntactically correct, it only gives back the two elements that are swapped...
@0 ' yes it does. I think the main reason why 1-space indentation looks bad is that in C-derived languages you often have long blocks and with 1-space indentation it's hard to tell where each specific block starts and ends (cc @user202729)
Because TIO has no auto indentation, if I use TIO I have to reduce indentation as much as possible. Is this readable? https://tio.run/##pVZbb9s2FH7Xr@A6zBFtSbHkNG2sy4CuaxFgD33IsAKpYdAybROlJYGkE7uG//qyQ1L0LSlaYHqQxHP5zuHhubBsmnBelk9Pv7Kq5KspzVgtlaBkWXhHpCWpWHNEeaClqsURgfB5LZhaHKuVS6IWhedN69WEU1TWlVR03Qj06TYfRPFV/PomuX49eP325s3NIBm8vbpOrq8Gg7eD5M1N6nngxqpUqFFbD7FKoXWwST1Y@ni7M19L1O8NHq79NQ42/qZlorqhgoCPPR8WBBvjW0HVSlRou@6RCODgvdmlp/Lhi/KhkQ@d/OXlsUrXePJMp0uCTZeAvBYXTH5F9QMVM14/smputnR9NVZoWqsXTK4NqBbAYLq3OV5utAtOvarF0v@u7onmid7B@R8Y34QnxtcapD1RokiVnBmXajocWsYmWGMt7aFJXfO9xewli7/kAP37OoP3cJPZP…
(Why are some answers of this question not CW? Old SE rule?
Hm, post merged.
The bounty notice is gone, so I would like to note for posterity that the bounty was offered to the best answer that did not include the letter ‘e’, and this post was the brilliant result. — MJDMar 18 '16 at 15:05
Blindfolded Arithmetic
Possibly a fairly easy language to start off with, relatively
speaking. (There are limits on how difficult a language I can make
because I have to prove it Turing-complete myself!)
For this language, the program set is the set of Blindfolded
Arithmetic programs as given ...
12 hours left.
Ok, some thoughts. If i is zero, we can't do anything at all. If i is nonzero, it's possible to divide i by i to get 1, and then you can get any constant.
It's also possible to div/mod2 and multiply by 2, (with 1 temporary variable), so 2 variables make a tape of bits.
Assume c is a condition which is either 0 or 1.
Then if c: a += b is a += x * c (similar for -)
if c: b /= 2 is b /= 1 + c. (similar for *)
Also the state can be stored as a power of 2. (and then use repeated div/mod by 2)
It's even possible to store half of the tape and the state together at i. Then at divide by 0 exception both the state and the data can be outputted.
So, assume N is hardcoded and state is a non negative integer < N, and a stores the first part of the tape and i stores the state and the second part of the tape,
the operations that need to be supported are: <> (tape movement), * (bit toggle), all conditional.
@user202729 it's called the "Haar random" normally. The standard method is z = 1/math.sqrt(2)*(random_state.normal(size=(dim,dim)) + 1j*random_state.normal(size=(dim,dim))) q, r = scipy.linalg.qr(z) d = r.diagonal() q *= d/abs(d) return q
In mathematics, a complex square matrix U is unitary if its conjugate transpose U∗ is also its inverse—that is, if
U
∗
U
=
U
U
∗
=
I
,
{\displaystyle U^{*}U=UU^{*}=I,}
where I is the identity matrix. In physics, especially in quantum mechanics, the Hermitian conjugate of a matrix is denoted by a dagger (†) and the equation above becomes
U
...
@user202729 :)
so in pure python the task is well specified
but of course every language has its own standard library
and they are different from each other
so it seems to say "use any language you like along with its standard library"
Here's an interesting sequence discovered by Paul Loomis, a mathematician at Bloomsburg University. From his page on this sequence:
Define
f(n) = f(n-1) + (the product of the nonzero digits of f(n-1))
f(0) = x, with x as any positive integer, written in base 10.
So, starting with f(0)=1, you ge...
I just love this simple cypher, it's so fun reading not-quite human-readable words and filling the gaps...
Ot wes thi bist uf tomis, ot wes thi wurst uf tomis,
ot wes thi egi uf wosdum, ot wes thi egi uf fuuloshniss,
ot wes thi ipuch uf biloif, ot wes thi ipuch uf oncridaloty,
ot wes thi sies...
I was wondering the same thing. I bet it has something to do with the properties of summing the digits of multiples of 3 always results in a factor of 3
searching for the first 1 000 integers by testing them on the first 10 000 integers and their reverses only gives 1, 3, and 9 as numbers that satisfy this rule
So inspired by a recent CMC in TNB, I have a question that maybe you math nerds/geniuses could help with. 3 and 9 have interesting modular properties in base 10. The sum of the digits of any factor of 3 or 9 will always be another factor of 3 or 9. Now it's pretty obvious why this works for 9, because in base b=10, 9 is b-1. And this works for other bases (multiples of 4 in base 5 sum to factors of 4 for example).
hm, would it be a good idea to post an announcement over meta regarding a consensus for command-line flags? it's been in a somewhat more specific question for a few months
cat /proc/cpuinfo reports that the avx2 flag is set.
However, the AVX2 instruction vpbroadcastb causes an illegal instruction exception when ran.
I am using x86_64 Linux and nasm as my assembler. On my system, reproducing this is as simple as
global main
main:
vpbroadcastb %ebx,%xmm1
using ...
Background
The Royal Netherlands Meteorological Institute defines a heat wave* as a series of at least 5 consecutive days of ≥25°C weather (“summery weather”), such that at least 3 of those days are ≥30°C (“tropical weather”).
*(Well, by Dutch standards.)
Challenge
Given a non-empty list of p...
The .bss section is simply a way of saying 'I want this amount of space beforehand'
You cannot store extra information in the section, it's entire purpose is preallocating space, and it does not allow initializing the data beforehand.
Should the size of the .bss section count against the score...
Are there Infinitely Many Power Means that are Integers?
Input: a list a of n positive integers.
Let M_p be equal to the pth root of 1/n * (a[0] + a[1] + ... + a[n-1]), where p is an integer.
Where p is equal to zero, M_p is equal to the geometric mean of the integers in a, since M_p actually ...
Input: a list a of n positive integers.
Let M_p be equal to the pth root of 1/n * (a[0] + a[1] + ... + a[n-1]), where p is an integer.
Where p is equal to zero, M_p is equal to the geometric mean of the integers in a, since M_p actually converges towards the geometric mean where p tends towards...
Sequences in π and e
code-golf pi e transcendental-numbers
Your task is simple: take as input a positive integer n. Print or return the longest sequence of digits that appears in the first n decimal digits of BOTH pi (3.14159...) and e (2.71828...). The ones-place digits, 3 and 2, are included....