text:
Find the identity sandpile
This question is about abelian sandpiles. Read this previous challenge and watch this numberphile video to learn more.

An abelian sandpile of size n by n is a grid containing the number 0, 1, 2 and 3 (representing the number of grains of sand). Adding two sandpiles works by first adding element by element, and then toppling any element that goes above 3. The order in which you topple doesn't matter, the end result is the same. When a cell topples its number decreases by 4, and each of its direct neighbors increases by 1. This can cause a chain reaction. If a cell is on the edge of the grid, any grains that fall off the grid while toppling disappear.
For example, I'm adding two 3 by 3 sandpiles (giving a rather extreme chain reaction):
3 3 3   1 2 1   4 5 4    4 6 4    6 2 6    6 3 6    2 5 2    4 1 4    4 2 4    0 4 0    2 0 2    2 1 2
3 3 3 + 2 1 2 = 5 4 5 -> 6 0 6 -> 2 4 2 -> 3 0 3 -> 5 0 5 -> 1 4 1 -> 2 0 2 -> 4 0 4 -> 0 4 0 -> 1 0 1
3 3 3   1 2 1   4 5 4    4 6 4    6 2 6    6 3 6    2 5 2    4 1 4    4 2 4    0 4 0    2 0 2    2 1 2

In this challenge we're interested in a subset of all possible n by n sandpiles. This subset contains any sandpile that you can get by adding an arbitrary sandpile to the all-3s n by n sandpile. For example, just above we saw that 212 | 101 | 212 is in the subset, because we got it by adding something to the all-3 sandpile.
Now this subset has an interesting element: the identity element. If you take this element and add it to any other element in the subset, the sum is unchanged. In other words, this sandpile acts like a zero of this subset. It just so happens that 212 | 101 | 212 is the zero element for the subset of 3 by 3. For example:
2 2 2   2 1 2   4 3 4    0 5 0    2 1 2    2 2 2
2 2 2 + 1 0 1 = 3 2 3 -> 5 2 5 -> 1 6 1 -> 2 2 2
2 2 2   2 1 2   4 3 4    0 5 0    2 1 2    2 2 2

Now this is your challenge: given n, find the identity element of the subset of the n by n grid. Output it by assigning a unique color with sufficient contrast of your choice to each of 0, 1, 2, 3 and outputting an n by n image. Your code must be able to produce the 50 by 50 case in under a minute on a reasonable modern PC.

For example, the 500 by 500 identity element:

Here is blue = 3, green = 2, red = 1, white = 0. But you don't have to use this color scheme in your answer.

A word of warning to competitors: I described what the solution is, not how to compute it. Your code must be able to produce the 50 by 50 case in under a minute, so brute forcing is not a possibility. There are algorithms for solving this, and I'm not giving you them. That's intentional. I feel that too many challenges present you with pre-chewed food. I will give a +100 bounty to the first answer that doesn't trivialize the problem with a builtin (looking at you, Mathematica), at my discretion.

I think the image of the 500x500 identity would benefit from saying what number each color corresponds to.

What constitutes "sufficient contrast"?

@ConorO'Brien Any set of colors that are sufficiently distinguishable. I could make it 100% objective with some color measure, but I feel that's overkill. I don't care if you use red, yellow, green, grayscale, or whatever, just don't use 4 shades of grey that are within 1% of eachother (like #000000, #000001, #000002, #000003).

ahem I believe this question is now eligible for bounty. Could I get the +100 bonus? :)

@JungHwanMin Gotta wait 24 hours :)

Octave, 120 113 bytes
function a=W(a);while nnz(b=a>3);a+=conv2(b,[t=[0 1 0];!t;t],'same')-b*4;end;end;@(n)imagesc(W((x=ones(n)*6)-W(x)))

Thanks to JungHwan Min for providing a link to the reference paper in his Mathematica answer.
Thanks to Stewie Griffin saved me 7 bytes [any(any(x)) -> nnz(x)]
Here two function is used:
1.f: for stabilization of a matrix
2. An anonymous function that takes n as input and shows the identity matrix.
Try It On rextester! for generation of a 50 * 50 matrix
Elapsed time for computation of the matrix: 0.0844409 seconds.
Explanation:
Consider a function f  that stabilizes a matrix the task of finding the identity is simply
f(ones(n)*6 - f(ones(n)*6).
that ones(n)*6 means a n*n matrix of 6.
so for n=3:
M = [6 6 6
     6 6 6
     6 6 6];

The result will be f(M-f(M))
For stabilization function  2D convolution used to speed the task;
In each iteration we make a binary matrix b with the same size of the input matrix and set it to 1 if corresponding element of the input matrix is >3.
Then we apply a 2D convolution of the binary matrix with the following mask
0 1 0
1 0 1
0 1 0

representing four direct neighbors .
Result of convolution is added to the matrix and 4 times the binary matrix subtracted from it.
The loop continued until all element of the matrix are <= 3
Ungolfed version:
function a=stabilize(a)
    mask = [t=[0 1 0];!t;t];
    while any(any(b=a>3))
        a+=conv2(b,mask,'same')-b*4;
    end
end
n= 50;
M = ones(n)*6;
result = stabilize(M-stabilize(M));
imagesc(result);

Mathematica, 177 157 135 133 bytes
Colorize[f=BlockMap[⌊{l={0,1,0},1-l,l}#/4⌋~Total~2+#[[2,2]]~Mod~4&,#~ArrayPad~1,{3,3},1]&~FixedPoint~#&;k=Table[6,#,#];f[k-f@k]]&

Takes a number n. The output is the identity sandpile. 0 is black, 1 is light gray, 2 is magenta, and 3 is blue-gray.
Sadly, Mathematica does not have a builtin for this...
Uses the algorithm stated in Scott Corry and David Perkinson's paper.
Takes 91.7 seconds on my 5-year-old laptop to calculate the 50x50 identity sandpile. I am confident that a reasonable modern desktop computer is more than 50% faster. (I also have a way faster code at the end).
Explanation
f= ...

Define function f (the input is a sandpile matrix): a function that ...
BlockMap[ ... ]~FixedPoint~#&

... repeats the BlockMap operation until the output does not change. BlockMap operation: ...

#~ArrayPad~1

... pad the input array with one layer of 0 ...
{3,3},1

... partition it into 3x3 matrices, with offset 1 ...
⌊{l={0,1,0},1-l,l}#/4⌋~Total~2+#[[2,2]]~Mod~4&

... and for each partition, add the number of sand grains toppled onto the center cell and the center cell value mod 4.
i.e. the output of f is the stabilized version of the input.

k=Table[6,#,#]

Define k as an n by n array of 6s.
f[k-f@k]]

Compute f(k - f(k)).
Colorize[ ... ]

Apply colors to the result.
Faster version (142 bytes)
Colorize[r=RotateLeft;a=ArrayPad;f=a[b=#~a~1;b+r[g=⌊b/4⌋,s={0,1}]+g~r~-s+r[g,1-s]+r[g,s-1]-4g,-1]&~FixedPoint~#&;k=Table[6,#,#];f[k-f@k]]&

Same code, but uses built-in list rotation instead of BlockMap. Computes n=50 in 4.0 seconds on my laptop.

Considering that you followed the spirit of the time limit (implementing an actual algorithm rather than brute force), and it's very much plausible that a powerful desktop computer is 50% faster, I'll allow it. Since it implements an actual algorithm without a trivializing built-in, this qualifies for the +100 bonus. You'll have to wait for it though, as I can't start a bounty yet.

That being said, implementing this quite trivially in Python (a notoriously slow language), only takes ~2s for n = 50. Maybe you can speed it up a bit?

@orlp Done, but it's longer than the original code. Should I make the faster version my main answer or can I just put it at the end?

Like this is fine I think.

Python 3 + Numpy + PIL, 385 370 364 bytes
import numpy as q,PIL.Image as w
n=int(input())
z=n,n
def r(p):
 while len(p[p>3]):
  for x,y in q.ndindex(z):
   if p[x,y]>3:
    p[x,y]-=4;p[x-1,y]+=x>0;p[x,y-1]+=y>0
    if~-n>x:p[x+1,y]+=1
    if~-n>y:p[x,y+1]+=1
s=q.full(z,6)
t=s.copy()
r(t)
i=s-t
r(i)
w.fromarray(q.uint8(q.array(q.vectorize(lambda x:[x//1*65]*3,otypes=[object])(i).tolist()))).save('i.png')

Takes input on STDIN. Outputs the image as greyscale to i.png. Black corresponds to 0, dark grey to 1, light grey to 2, and white to 0.
Uses the formula I = R(S - R(S)), where I is the identity element, S is the matrix filled with sixes, and R is the reduction function.
I could probably save some bytes by switching to Python 2 and doing from numpy import*, but (1) I don't have Numpy installed on Python 2 and (2) the program wasn't terminating with from numpy import*.
Ungolfed:
import numpy as np
from PIL import Image

# Compute the identity element

n = int(input('Size of the sandpile: '))

def reduce_pile(sandpile):
  while any(element >= 4 for element in np.nditer(sandpile)):
    for x, y in np.ndindex((n, n)):
      if sandpile[x, y] >= 4:
        sandpile[x, y] -= 4
        if x > 0: sandpile[x - 1, y] += 1
        if y > 0: sandpile[x, y - 1] += 1
        if x < n - 1: sandpile[x + 1, y] += 1
        if y < n - 1: sandpile[x, y + 1] += 1

s = np.full((n, n), 6, dtype=np.int32)
s_prime = np.copy(s)

reduce_pile(s_prime)

identity = s - s_prime
reduce_pile(identity)

# Output it to identity.png as an image

colours = [[255, 255, 255], [255, 0, 0], [0, 255, 0], [0, 0, 255]]
img_array = np.vectorize(lambda x: colours[x], otypes=[object])(identity)
img_array = np.array(img_array.tolist(), dtype=np.uint8)

img = Image.fromarray(img_array)
img.save('identity.png')

You may be able to save bytes by using scipy or matplotlib to display the data rather than generating an image explicitly with PIL.


text:
Hex Dump your Source Code
When code-golfing there will be times where you need a Hex Dump of your code, usually because you've used unprintable characters. So, why not make a program that Hex Dumps itself?
The Challenge
This challenge is to, given no input, output a Hex Dump of your source code in the following formatting:
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

Or, for example, if your program was print("SomeString"):rep(123)
0000: 70 72 69 6e 74 28 5c 22 53 6f 6d 65 53 74 72 69  print("SomeStrin
0010: 6e 67 5c 22 29 3a 72 65 70 28 31 32 33 29        g"):rep(123)

Specifics
The hex dump is split into rows of three parts, each row representing 16 bytes of your source code.
The first part is the memory address. It specifies where the current row starts in your code. Written as a 2 Byte Hexadecimal number, followed by a :, then a space.
The Second, is the Hex Dump itself. This is 16 bytes of your Source Code, written in Hexadecimal form separated by spaces. This should be an accurate byte representation using your code's encoding.
Lastly, after a two space gap, is the code itself. This is simply 16 characters of your code, with Non printable characters written as .
Notes

This is a quine challenge, so Standard Quine Rules apply.
And this is code-golf challenge too, so Standard Loopholes apply.
As shown in the second example, do not write bytes after EOF, instead use whitespace.
Trailing whitespace is fine.
Inbuilts to Hex dump, if you happen to have one in this specific format, are not banned but are frowned upon.
Non printable characters refer to any character that, represented as only a single byte, cannot be represented as a single spaced glyph. For UTF-8, this means 0-31, 128-255. For the Jelly Codepage, as all characters can be represented as a single spaced glyph, there are no Non printable characters.

related/duplicate? http://codegolf.stackexchange.com/q/11985/47022

Personally I feel like this is an applied quine makes it different enough, but I'm willing to see the community's thoughts.

So for the record, you can't read your file name and xxd it?

Of course not, standard Quine rules disallow that

What exactly is an unprintable?

Depending on the chosen encoding, any Single Byte that is not represented by a single glyph, EG. SOH, \n, \r or, for ascii, anything >= 128.

For UTF-8, this is anything from 0-31, and 128-255

I'm not sure I understand the purpose of the 8-bit encoding rule. If I can replicate the bytes of the file the interpreter received, why not let me? 2. Using only 2 bytes for the line offset unnecessarily excludes languages that require more than 65536 bytes for this task.

@Dennis what would you suggest is a good offset?

@Dennis I feel these are good points, so I will remove the encoding rule. However, I don't plan to remove the 2 byte line offset rule, as I don't, personally, want that to be dynamic. I feel it necessary to exclude languages that cannot achieve the task in under 65kb.

Personally, I'd leave it up to the answer. Excluding a language because of this is absolutely unnecessary in my opinion. If you insist on a fixed width, use something that should be enough for most languages. Most hexdump utilities use 7 hex-digits.

Also, you don't mention in your specs that there should be two spaces between the hexadecimal representation and the characters. You should also specify what exactly you mean by printable, this this varies by encoding.

Is ASCII 127 printable or nonprintable?

No, it is used as a control character for delete.

V, 39 bytes
ñi241"qp:%!xxd
Î4x
Íøø / &
f&3i ÿ

Try it online!
Note that normally V uses the latin1 encoding, where this is 36 bytes (which is what TIO says) but this submission is using UTF-8 where it is 39 bytes.
This is pretty much just a modification of the V-quine template I wrote about.

Shouldn't the newline 0a at the end of the output be removed?

@kritixilithos Ah, I forgot about that. It's easier to just add a newline to the end.

Perl, 81 bytes
#!perl -l
$_=q($%+=print"00$%0: @{[unpack'(H2)*']}  $_"for"\$_=q($_);eval"=~/.{16}/g);eval

Counting the shebang as one. Having the code length be a multiple of 16 saves quite a bit on formatting. Using eval to reassign $_ to itself borrowed from ais523.
Output:
0000: 24 5f 3d 71 28 24 25 2b 3d 70 72 69 6e 74 22 30  $_=q($%+=print"0
0010: 30 24 25 30 3a 20 40 7b 5b 75 6e 70 61 63 6b 27  0$%0: @{[unpack'
0020: 28 48 32 29 2a 27 5d 7d 20 20 24 5f 22 66 6f 72  (H2)*']}  $_"for
0030: 22 5c 24 5f 3d 71 28 24 5f 29 3b 65 76 61 6c 22  "\$_=q($_);eval"
0040: 3d 7e 2f 2e 7b 31 36 7d 2f 67 29 3b 65 76 61 6c  =~/.{16}/g);eval

Try it online!

Perl + xxd + cut, 61 bytes
$_=q(open F,"|xxd -g1|cut -c5-";print F"\$_=q($_);eval");eval

Try it online!
This is a universal quine constructor in Perl + a call to xxd and cut to do the hexdumping. None of the programs in question have a builtin to do a hexdump in the format in the question; however, xxd -g1 comes very close and so it's possible to use cut to trim the output into the correct shape.
The universal quine constructor is $_=q("\$_=q($_);eval");eval, which creates a copy of its own source code in memory, and can be modified to perform arbitrary operations on it. In this case, I use open "|" and print to pipe the input into external programs, xxd which does the bulk of the hexdumping work and cut which changes it into the required format.

JavaScript (ES6) 229 219 162 bytes
Thanks to @Neil for saving a lot of bytes
Note
Quite a few people think accessing the source code of a function the way I do it is cheating, but according to @Dennis, it's fine. As such, I'll leave my answer here.
Code
f=_=>([...c=`f=`+f].map(d=>d.charCodeAt()[t=`toString`](16)).join` `+` `.repeat(46)).match(/.{48}/g).map((s,i)=>`00${i[t](16)}0: `+s+c.substr(i*16,16)).join`\n`

Usage
f()

Simply call the function with no arguments.
Output
0000: 66 3d 5f 3d 3e 28 5b 2e 2e 2e 63 3d 60 66 3d 60 f=_=>([...c=`f=`
0010: 2b 66 5d 2e 6d 61 70 28 63 3d 3e 63 2e 63 68 61 +f].map(c=>c.cha
0020: 72 43 6f 64 65 41 74 28 29 5b 74 3d 60 74 6f 53 rCodeAt()[t=`toS
0030: 74 72 69 6e 67 60 5d 28 31 36 29 29 2e 6a 6f 69 tring`](16)).joi
0040: 6e 60 20 60 2b 60 20 60 2e 72 65 70 65 61 74 28 n` `+` `.repeat(
0050: 34 36 29 29 2e 6d 61 74 63 68 28 2f 2e 7b 34 38 46)).match(/.{48
0060: 7d 2f 67 29 2e 6d 61 70 28 28 73 2c 69 29 3d 3e }/g).map((s,i)=>
0070: 60 30 30 24 7b 69 5b 74 5d 28 31 36 29 7d 30 3a `00${i[t](16)}0:
0080: 20 60 2b 73 2b 63 2e 73 75 62 73 74 72 28 69 2a  `+s+c.substr(i*
0090: 31 36 2c 31 36 29 29 2e 6a 6f 69 6e 60 5c 6e 60 16,16)).join`\n`

(not sure that 'f='+f is allowed under standard quine rules but if it is then for 161 bytes I give you f=_=>([...c=\f=`+f].map(c=>c.charCodeAt().toString(16)).join` `+` `.repeat(46)).match(/.{48}/g).map((s,i)=>`00`+i.toString(16)+`0 `+s+c.substr(i*16,16)).join`\n``.

Clever approach. I read some questions, and is appears people generally think it's considered cheating because I'm abusing a convenient language feature. I'll add that, along with your improved code, to my answer.

I think it is allowed, Dennis said on another quine challenge that using function source inspection is fine, and I know several "Golf a quine" answers use this.

Change the first .toString to [t=toString] and the second to [t] to save 3 bytes. Change the <backtick>\n<backtick> to <backtick><newline><backtick> to save another one.

Changing it the string method requires the function name to be a string, as such, it only saves one byte. As for the newline, it would result in an a in the hex dump, which needs a 0 prepended, and adding that check would only increase the bytecount.

Ruby, 128 112 bytes
eval b='7.times{|y|$><<"%04x:"%y*=16;c=("eval b="+(a=39.chr)+b+a)[y,16];c.chars{|x|$><<" %x"%x.ord};puts"  "+c}'

Without trailing newline.
Thanks primo for the idea of aligning to 16-byte boundary.
Output
0000: 65 76 61 6c 20 62 3d 27 37 2e 74 69 6d 65 73 7b  eval b='7.times{
0010: 7c 79 7c 24 3e 3c 3c 22 25 30 34 78 3a 22 25 79  |y|$><<"%04x:"%y
0020: 2a 3d 31 36 3b 63 3d 28 22 65 76 61 6c 20 62 3d  *=16;c=("eval b=
0030: 22 2b 28 61 3d 33 39 2e 63 68 72 29 2b 62 2b 61  "+(a=39.chr)+b+a
0040: 29 5b 79 2c 31 36 5d 3b 63 2e 63 68 61 72 73 7b  )[y,16];c.chars{
0050: 7c 78 7c 24 3e 3c 3c 22 20 25 78 22 25 78 2e 6f  |x|$><<" %x"%x.o
0060: 72 64 7d 3b 70 75 74 73 22 20 20 22 2b 63 7d 27  rd};puts"  "+c}'

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Neutralize data
To neutralize data, recursively replace all numbers (not digits!) with zeros and all characters (not strings!) with spaces.
You must accept any single number, character, or string, or possibly recursive array* of mixed numeric/character data that your language can handle. For example, you must accept actual strings (and not restrict your input to lists of single characters) if your language can handle such.
If your language contains a built-in which does all or most of this task, I would appreciate an additional alternative version without it.
The shortest submission in each language is a winner, and will receive an upvote from me.
Sample cases

"" → ""
7 → 0
123.456 → 0
"X" → " "
"  " → "  "
"Yo!" → "   "
[] → []
[-1.2E3] → [0]
["Hey"] → ["   "]
["H","e","y"] → [" "," "," "]
["R",2,"D",2] → [" ",0," ",0]
["C","3","P",0] → [" "," "," ",0]
["THX",[1138]] → ["   ",[0]]
["T","H","X",[1138]] → [" "," "," ",[0]]
[[["H"],"e",1,1,0],[[-3],"arth"]] → [[[" "]," ",0,0,0],[[0],"    "]]

* If your language has several types which can equally well represent arrays like the above examples, you may chose to support only one. Two entries can both win, even though they are using the same language, by each going with a different data type.

What if our language doesn't distinguish between characters and length-1 strings?

@xnor AFAICT the effect would be the same.

Oh, I see that now from the test cases, but it wasn't clear to me that meant to take every string element and replace each of its characters with spaces. Actually, I didn't interpret that the replacements have to be done recursively at all. The spec talks about neutralizing an array, but it looks like you want single elements not in an array to be acted on as well?

@xnor Correct. Feel free to edit the question to better reflect this.

Let us continue this discussion in chat.

What if our language doesn't distinguish between numbers and strings of digits?

Also, what about languages that don't have a string or character data type? Can they just replace the numbers, or are they disallowed for this challenge?

@DLosc Not disallowed, but rather pointless. I suppose this either isn't a production grade language or is a very old language. Feel free to submit anyway.

JavaScript (ES6), 53 47 bytes
f=o=>o.big?o.replace(/./g,' '):o.map?o.map(f):0

Test cases

f=o=>o.big?o.replace(/./g,' '):o.map?o.map(f):0

test = [
  "",
  7,
  123.456,
  "X",
  "  ",
  "Yo!",
  [],
  [-1.2E3],
  ["Hey"],
  ["H","e","y"],
  ["R",2,"D",2],
  ["C","3","P",0],
  ["THX",[1138]],
  ["T","H","X",[1138]],
  [[["H"],"e",1,1,0],[[-3],"arth"]]
];

test.map(o => {
  console.log(JSON.stringify(o), '=>', JSON.stringify(f(o)));
});

Finally, a use for big()! Although, you'd probably provide better future-proofing using raw() instead.

@Shaggy Hmm. Which syntax would you use with raw()? I don't think String.prototype.raw() is defined. Only String.raw() is.

Oh, yeah, sorry.

Ruby, 54 53 49 bytes
f=->a{a*0==0?0:a*0==[]?a.map{|x|f[x]}:" "*a.size}

Maybe there is a better way, but:

x*0 == 0 for integers
x*0 == "" for strings
x*0 == [] for arrays

Clever! Thanks for giving me a way to determine types in Python as well!

it doesn't work for the string and number examples outside of an array, but if you change a.map to [*a].map it works as expected

This has been fixed now, thanks.

Python 2, 52 bytes
f=lambda x:1-(x<{})and map(f,x)if x<''else' '*len(x)

Try it online!
How it works
Python lets you compare different types. Numeric types are always smaller than iterables, and iterables are sorted by their type names, so
0 < {} < [] < '' < ()

This way, f does the following.

If x is numeric x<{} returns True and 1-(x<{}) returns 0. The code after and does not get executed.
If x is iterable, 1-(x<{}) returns 1 (truthy), so the code after and gets executed.

If x is a list, x<'' is true and f gets mapped over its items.
If x is a string, x<'' is false and x is replaced with a string of spaces of the same length.

Mathematica, 51 bytes
I've currently got two solutions at this byte count:
#/._?NumberQ->0/.x_String:>StringReplace[x,_->" "]&
StringReplace[#,_->" "]~Check~#&//@#/._?NumberQ->0&

The second one throws a bunch of warnings which can be ignored.
Explanation
In either case, we start by turning numbers into zeros with
#/._?NumberQ->0

Then to process the string, there are two options. Either, we use another substitution that only applies to strings:
.../.x_String:>StringReplace[x,_->" "]

Or, we use the MapAll operator //@ which maps a function over every single element in a nested list. The catch here is that we'll be trying to use StringReplace on zeros as well as the symbol List (since //@ also goes through the heads of expressions), so we need to use Check (sort of like a catch statement in other languages) to avoid wreaking havoc with those values:
StringReplace[#,_->" "]~Check~#&//@...

Perl 6, 34 48 bytes

{.deepmap:{$_~~Str??" "x.comb!!0}}

{$_~~List??$_».&?BLOCK!!$_~~Str??" "x .comb!!0}

Expanded:
{                          # block-based lambda
    $_ ~~ List             # if argument is a list/array
        ?? $_».&?BLOCK     # then recurse for each element (&?BLOCK is a compile-time var)
        !! $_ ~~ Str       # else if argument is a string
            ?? " "x .comb  # then use space repeated by the string's length,
            !! 0           # else use the number 0
}

The .deepmap  doesn't work correctly for singular inputs like "X" or 7, because it always returns a List.

Darn, I must have overlooked that (or the task was clarified later). This makes it quite a bit longer.

Jelly, 4 bytes
nOa⁶

This is a monadic link. Jelly's implicit printing does a lot of splatting; to verify that the output is what it should be, you can view the internal representation with ŒṘ. Note that this exposes strings as lists of characters, which is how the Jelly interpreter implements them.
Try it online!
How it works
nOa⁶  Monadic link. Argument: z

 O    Ordinal; replace all characters with the code points.
      This does not affect numbers.
n     Vectorizing not-equal; compare z with the result to the right, replacing
      characters with 1 and numbers with 0.
  a⁶  Logical AND space; replace all 1's with spaces.

I was waiting for an APL to come up. Now chose a different one for a 1-byte solution!

Thanks for the heads up, but I'm not sure I even know how to represent [[["H"],"e",1,1,0],[[-3],"arth"]] in APL...

JSON2APLexpr←⎕SE.Dyalog.Utils.repObj 7159⌶ ⋄ JSON2APLexpr'[[["H"],"e",1,1,0],[[-3],"arth"]]' gives ((,⊂,'H') (,'e') 1 1 0) ((,¯3) 'arth'). FYI, 7159⌶ will be ⎕JSON in version 16.0.

APL can tackle any JSON. However, plenty of APL data cannot be unambiguously represented in JSON.

Do you think a code-golf which involves parsing or maybe manipulating APL arrays would be interesting?

@Adám As long as you can make the question self-contained, that should be rather interesting. I did something similar for Jelly once: Jam don't add like that

GAP, 91 bytes
GAP has a method Zero that returns the neutral additive element corresponding to an element of an additive structure. That handles numbers and even lists of numbers which are considered vectors, but not arbitrary lists. So let's add these and Chars and use that Strings are lists of Chars:
InstallOtherMethod(Zero,[IsChar],c->' ');
InstallOtherMethod(Zero,[IsList],l->List(l,Zero));

(I'm not counting the newline as it isn't needed.) Of course this is far away from the intended use of Zero, and GAP would complain if I hadn't used InstallOtherMethod.  Now I can do:
gap> Zero([[["H"],"e",1,1,0],[[-3],"arth"]]);
[ [ [ " " ], " ", 0, 0, 0 ], [ [ 0 ], "    " ] ]

I wouldn't say that the builtin does most of the job, one might rather suspect that writing a normal function should be shorter, but my best try doing that was 92 bytes long:
f:=function(x)if IsInt(x)then return 0;elif IsList(x)then return List(x,f);fi;return' ';end;

Haskell, 115 bytes
My language cannot handle any mix of numbers and strings in lists (but of course you can define a sum type and put that in a list), and its standard lists cannot handle differently nested lists. So I'm just doing what it can handle. I think that is not unfair because it is still long, and I mainly do it to show features of haskell that are rarely seen in haskell golfing solutions. Note that Strings are lists of Chars.
class N a where n::a->a
instance N Double where n _=0
instance N Char where n _=' '
instance N a=>N[a]where n=map n

This handles any number as Double:
*Main> n 42
0.0
*Main> n 123.456
0.0
*Main> n "hi"
"  "
*Main> n [[1,2],[3,4,5]]
[[0.0,0.0],[0.0,0.0,0.0]]
*Main> n ["hello","world!"]
["     ","      "]

It should be shorter to define a data structure with data N=S[Char]|I Int|L[N] and a recursive function on that.

You're probably right I guess, but that's less interesting and still looks like not really solving the problem (I admit it actually is closer). I'll leave that for someone else.

integers? How about test case 3.?

@Adám Oh you're right, and unfortunately I can't claim my language doesn't have those. Can I only handle Doubles? I can input them without decimal point.

@ChristianSievers Yes, that's fine. Basically, you should be able to handle whatever an import (if possible) from the given JSON would give you.

PHP, 91 bytes
function f($a){return!is_array($a)?is_string($a)?str_pad("",strlen($a)):0:array_map(f,$a);}

if parameter is array: recurse using array_map.
else if parameter is string: generate a strings of spaces with the same length.
else 0.
is_string saves one byte over is_numeric;
negating is_array() renders parentheses obsolete.
Altogether it´s 17 bytes shorter than if()recursion-loop;else x?string:number with a call by reference.

Python 2, 59 bytes
g=lambda d:0if d*0==0else " "*len(d)if d*0==""else map(g,d)

uses G B's way to determine types

 Common Lisp, 87
(defun c(e)(typecase e(list(mapcar'c e))(number 0)(string(map'string(lambda(u)#\ )e))))

Ungolfed
(defun c(e)
  (typecase e
    (list (mapcar #'c e))
    (number 0)
    (string (map 'string (lambda(u) #\space) e))))

Example
> (c '((("H") "e" 1 1 0) ((-3) "arth")))
(((" ") " " 0 0 0) ((0) "    "))

APL (Dyalog) 13.2 and earlier, 1 byte
Until and including version 13.2, monadic ∊ did exactly this. The old behaviour can be activated by setting ⎕ML (Migration Level) to zero.
∊

Try it online!
Without using old behaviour it is 4 bytes:
⊃0⍴⊂

Try it online!
⊂ enclose
0⍴ make a length-zero list of copies of the entire input (preserves only structure and type info)
⊃ coerce one element from that (creates a prototypical array)

Groovy, 53 bytes
{[it].collectNested{it in String?" "*it.size():0}[0]}

This is an unnamed closure.
Try it here!
Explanation:
Groovy has this method .collectNested which helps to iterate through a list as if it was flattened.
To handle special cases where only an integer or a string is passed without a list, simply wrap every input into a list and output the first element.

Pyke, 8 bytes (Old version)
.FZ*0+d&

Explanation:
.FZ*0+d& - for i in deep_for(input):
  Z*     -    i*0
    0+   -   ^ + 0
      d& -  ^ and " "

This no longer works as an update made it so falsies of other types where there are truthies automatically convert to the falsey of the truthy type.

That's of course acceptable.

C#, 197 195 Bytes
a=>{if(a is string||a is char)return new string(' ',(a as string)?.Length??1);try{System.Convert.ToDecimal(a);return 0;}catch{}var b=(object[])a;for(int i=0;i<b.Length;)b[i]=n(b[i++]);return b;};

This function handles char, string, any builtin number type and recursive arrays.
Full program, ungolfed whit output helper:
using System.Linq;
class Class
{
    public static void Main()
    {
        System.Func<object, object> n = null;
        n = a =>
        {
            if (a is string || a is char)
                return new string(' ', (a as string)?.Length ?? 1);
            try
            {
                System.Convert.ToDecimal(a);
                return 0;
            }
            catch { }

            var b = (object[])a;
            for (int i = 0; i < b.Length;)
                b[i] = n(b[i++]);
            return b;
        };

        var result = n(new object[] { new object[] { new object[] { "H" }, 'e', 1.5, 1, 0 }, new object[] { new object[] { -3 }, "arth" } });
        System.Console.WriteLine(Output(result));
        System.Console.Read();
    }

    static string Output(object x)
    {
        var arr = x as object[];
        if (arr != null)
            return "[" + string.Join(",", arr.Select(Output)) + "]";
        else
            return x.ToString();
    }
};

The using statement is only needed for the output helper, not for the actual function.
Try Online

Javascript ES6, 81 chars
f=(x,t)=>(t=g=>eval(`try{x.${g}}catch(e){}`))`replace(/./g,' ')`||t`map(f)`||x&&0

Test:

f=(x,t)=>(t=g=>eval(`try{x.${g}}catch(e){}`))`replace(/./g,' ')`||t`map(f)`||x&&0

console.log(
`"" → ""
7 → 0
123.456 → 0
"X" → " "
"  " → "  "
"Yo!" → "   "
[] → []
[-1.2E3] → [0]
["Hey"] → ["   "]
["H","e","y"] → [" "," "," "]
["R",2,"D",2] → [" ",0," ",0]
["C","3","P",0] → [" "," "," ",0]
["THX",[1138]] → ["   ",[0]]
["T","H","X",[1138]] → [" "," "," ",[0]]
[[["H"],"e",1,1,0],[[-3],"arth"]] → [[[" "]," ",0,0,0],[[0],"    "]]`
.split`
`.map(s => s.split` → `.map(eval))
.every(([s,k]) => JSON.stringify(f(s))==JSON.stringify(k)))

Java 7, 262 (268) bytes
import java.util.*;Object c(Object o){if(o instanceof List){List r=new ArrayList();for(Object x:(List)o)r.add(c(x));return r;}if(o instanceof String){String r="\"";for(int i=((String)o).length();i-->0;r+=" ");return r+"\"";}return o instanceof Number?0:o instanceof Character?"' '":"";}

282 + 6 for the added \" and ' to pretty-print the String and characters.
Explanation:
import java.util.*;            // Required import for List and ArrayList
Object c(Object o){            // Method with Object parameter and Object return-type
  if(o instanceof List){       //  If the input is a List
    List r=new ArrayList();    //   Create a result-list
    for(Object x:(List)o)      //   Loop over the items of the input-list
      r.add(c(x));             //    And add all items with a recursive-call to this method
                               //   End of loop (implicit / single-line body)
    return r;                  //   Return result-list
  }if(o instanceof String){    //  If the input is a String instead
    String r="\"";             //   Create a result-String (starting with `"`
    for(int i=((String)o).length();i-->0;r+=" ");
                               //   Replace all characters in the String with a space
    return r+"\"";             //   Return the result within double-quotes
  }
  return o instanceof Number?  //  If the input is an integer or decimal instead:
    0                          //   Return 0
   :o instanceof Character?    //  If the input is a character instead:
    "' '"                      //   Return ' '
   :                           //  Else:
    "";                        //   Return an empty String
}                              // End of method

Test code:
Try it here.
import java.util.*;
class M{
  static Object c(Object o){if(o instanceof List){List r=new ArrayList();for(Object x:(List)o)r.add(c(x));return r;}if(o instanceof String){String r="\"";for(int i=((String)o).length();i-->0;r+=" ");return r+"\"";}return o instanceof Number?0:o instanceof Character?"' '":"";}

  public static void main(String[] a){
    System.out.println(c(""));
    System.out.println(c(7));
    System.out.println(c(123.456));
    System.out.println(c('X'));
    System.out.println(c("  "));
    System.out.println(c("Yo!"));
    System.out.println(c(new ArrayList()));
    System.out.println(c(new ArrayList(){{add(-1.2e3);}}));
    System.out.println(c(new ArrayList(){{add("Hey");}}));
    System.out.println(c(new ArrayList(){{add('H');add('e');add('y');}}));
    System.out.println(c(new ArrayList(){{add('R');add(2);add('D');add(2);}}));
    System.out.println(c(new ArrayList(){{add("THX");add(new ArrayList(){{add(1138);}});}}));
    System.out.println(c(new ArrayList(){{add('T');add('H');add('X');add(new ArrayList(){{add(1138);}});}}));
    System.out.println(c(new ArrayList(){{add(new ArrayList(){{add(new ArrayList(){{add('H');}});add('e');add(1);add(1);add(0);}});add(new ArrayList(){{add(new ArrayList(){{add(-3);}});add("arth");}});}}));
  }
}

Output:
""
0
0
' '
"  "
"   "
[]
[0]
["   "]
[' ', ' ', ' ']
[' ', 0, ' ', 0]
["   ", [0]]
[' ', ' ', ' ', [0]]
[[[' '], ' ', 0, 0, 0], [[0], "    "]]

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Split arrays and programs in half
Introduction
You have been tasked to write a program that splits a rectangular integer array evenly in half (for whatever reason).
This task is computationally intensive, but luckily you have a dual-core machine to perform the calculations.
To maximize the benefits of parallelism, you decide to split the program evenly in half and let each core run one of the parts independently of the other.
Input and output
Your input is a rectangular 2D array of nonnegative integers of size at least 1×1, taken in any reasonable format.
A splitting of such an array is obtained by splitting each horizontal row into a prefix and a suffix (either of which may be empty).
For a splitting to be valid, two adjacent rows must be split at the same index or adjacent indices.
For example, consider the array
2 4 5 5 6 3
9 7 1 7 7 0
0 0 3 6 7 8
1 2 4 7 6 1
6 6 8 2 0 0

This is a valid splitting:
 2;4 5 5 6 3
;9 7 1 7 7 0
;0 0 3 6 7 8
 1;2 4 7 6 1
 6 6;8 2 0 0

This is also a valid splitting:
2 4 5 5 6 3;
9 7 1 7 7;0
0 0 3 6 7;8
1 2 4 7;6 1
6 6 8;2 0 0

This is not a valid splitting:
2 4;5 5 6 3
9 7 1;7 7 0
0;0 3 6 7 8
1 2;4 7 6 1
6 6;8 2 0 0

Your output shall be the minimum value of
abs(sum_of_prefixes - sum_of_suffixes)

over all valid splittings of the input.
Rules and scoring
You shall write two programs (either full programs or functions) in the same language, which must not have any shared code between them.
Let's call them P1 and P2.
Program P1 takes the input array, and outputs something.
Program P2 takes this something as input, and outputs the answer of the above task for the input array.
Your score is the maximum of the byte counts of P1 and P2, lower score being better.
Some clarifications:

You can write two full prorgams, one function and one full program, or two functions.
In the case of two full programs, the entire output of P1 is fed to P2 as input, as in the Unix pipeline P1 | P2. The programs must function correctly if compiled/interpreted from two separate source files.
If either program is a function, it is converted to a full program by adding the necessary boilerplate code, and the above rule is applied to it. In particular, two functions cannot use shared auxiliary functions, shared import statements, or shared global variables.

Test cases
[[1]] -> 1
[[4,5],[8,3]] -> 4
[[8],[11],[8],[10],[4]] -> 1
[[5,7,0,9,11,2,1]] -> 7
[[146,194,71,49],[233,163,172,21],[121,173,14,302],[259,169,26,5],[164,30,108,37],[88,55,15,2]] -> 3
[[138,2,37,2],[168,382,33,77],[31,199,7,15],[192,113,129,15],[172,88,78,169],[28,6,97,197]] -> 7
[[34,173,9,39,91],[169,23,56,74,5],[40,153,80,60,28],[8,34,102,60,32],[103,88,277,4,2]] -> 0
[[65,124,184,141],[71,235,82,51],[78,1,151,201],[12,24,32,278],[38,13,10,128],[9,174,237,113]] -> 2
[[164,187,17,0,277],[108,96,121,263,211],[166,6,57,49,73],[90,186,26,82,138],[173,60,171,265,96]] -> 8

For a moment, I thought this was a [tag:multi-threading] question. I've been looking forward to more such.

Haskell, 102 bytes
Function 1 (102 bytes):
l=length
[]#i=[[]]
(r:s)#i=id=<<[(splitAt j r:)<$>s#j|j<-[i-1..i+1],j>=0,j<l r]
f r=(r#)=<<[0..l$r!!0]

Function 2 (90 bytes):
g::[[([Int],[Int])]]->Int
g a=minimum$map(\(x,y)->abs$sum(sum<$>x)-sum(sum<$>y))$unzip<$>a

Missing boilerplate for F1 to make it a full program, including the hardcoded integer array to check:
main = print $ f [[164,187,17,0,277],[108,96,121,263,211],[166,6,57,49,73],[90,186,26,82,138],[173,60,171,265,96]]

and for F2:
main = print . g . read =<< getContents

Now you can call runhaskell f1.hs | runhaskell f2.hs which outputs 8.
How it works: f takes a list of list of integers.
f r = (r#)=<<[0..l$r!!0]          -- for each index [0 .. length r] call # with
                                  -- the first parameter being r and
                                  -- collect the results in a single list

[]#i=[[]]                         -- base case. If the list of lists is empty, stop
(r:s)#i                           -- else let r be the first list, s all others
           j<-[i-1..i+1],         -- foreach possible index j for the next line
                 j>=0,j<l r       --    (skipping out of range indices)
     (splitAt j r:)<$>            -- split the current line at j into a pair of
                                  -- lists and prepend it to every element of
                      s#j         -- a recursive call with s and j
id=<<                             -- flatten into a single list

Now we have a list of all possible splits, for example the first one and a random one from the middle
[([],[164,187,17,0,277]),                  [([164,187],[17,0,277]),
 ([],[108,96,121,263,211]),                 ([108,96],[121,263,211]),
 ([],[166,6,57,49,73]),                     ([166],[6,57,49,73]),
 ([],[90,186,26,82,138]),                   ([90,186],[26,82,138]),
 ([],[173,60,171,265,96])]                  ([173,60,171],[265,96])]

Function g takes such a list and
                    unzip<$>a       -- turn every pair of lists into a list of pairs
  map(\(x,y)->                      -- foreach such pair
      abs$sum(sum<$>x)-sum(sum<$>y) -- calculate the score
minimum                             -- and find the minimum

Note: the second function can be golfed a little bit more, but it doesn't change the score.


text:
Hidden Inversions (Cops' Thread)
This is a cops-and-robbers puzzle the robbers' thread can be found here.
Your task will be two write two programs (or functions) such that they are anagrams of each other and one performs the left inverse of the other.  These programs may accept and output as many integers or complex numbers as you wish.  If you choose take numbers as character points or any other reasonable means you must indicate you are doing so in your answer.  If you choose to restrict the domain of your function you must also indicate the restricted domain in your answer.
You will then present the first program in the form of an answer with left inverse hidden for robbers to find.
The shown program must implement a injective function (otherwise it would be impossible for a hidden answer to exist).
If your answer has not been cracked in one week you may reveal the hidden answer and mark it as safe.  Safe answers cannot be cracked by robbers and will remain un-cracked indefinitely.
The goal will be to create the shortest un-cracked answer in bytes.
Example
You could show the following python program that adds one to the input
lambda x:~-x

A solution could be:
lambda x:-~x

This subtracts one from the input

Can we have imaginary/complex integers?

@stewie if you indicate so you may

Is anagramming defined as permuting the characters, or permuting the bytes (in languages which don't use a single-byte character set)?

"You will then present one of the programs" seems to suggest that we can choose which to present, but the sentence continues "with left inverse hidden", implying that we have to present a specific one. Which is it? 2. The question specifically states "program" and doesn't appear to permit functions, but the example is a function rather than a program. Which is it?

Does capitalisation matter?

@ais523 permuting bytes

@KritixiLithos To be anagrams the bytes should be the same.

@KritixiLithos By default, yes.

Is it a problem if f(g(x)) is potentially not exactly x due to floating point rounding, or would that be considered violating the injective function requirement?

@SLuck49 I believe that it is a meta consensus that floating point errors in the final answer are fine.  However if you are rounding on top of the floating point error (causing your answer to be wrong) I would consider that a violation of the requirements.

Python 3, 80 bytes (Cracked)
bhmq = int(input())
print(bhmq ** 2)
(1 or [(sqrt),(specification+of*integerr)])

Domain: positive integers. Function is just squaring of a number. Input to stdin, output to stdout, as well as in the inverse function. Note that Python ignores the third line here, because it is syntactically valid and 1 is already a truthy value, so Python doesn't even look whether the right part of 'or' is well-defined.
Robbers should write a sqrt function that will work correct on all non-zero squares, printing integer value as is, without floating point (so on input '4' output should be '2' or '2\n', not '2.0' or '2.0\n').

I like this one.  It is deceptively difficult to crack

Welcome to ppcg! Nice first post!

Just to clarify, the inverse must also work correctly for something that's too big for floating point, like 15831049540459311999115956046667536? If not, I cracked it.

Nevermind on that crack, I messed up. The question still stands though.

@orlp, although generally it is a hint, but I'll say that theoretically it works on any positive square (so don't assume presize floats) but practically it isn't feasible for such a big number.

Which version should I consider "Python 3"? I see there are different features I could use depending on the specific version. Is it "any Python 3.x"?

If we assume that the robber program must have the characters from  import*\nprint(int(input())), then the only valid imports are re,io,errno,abc,site,string,ast,org,os,stat for Python 3.5.2. I take it back, it might not be a complete list, because fractions would work. Anyway, there's no additional m for math. Is there a way to do an import without from that doesn't use a .?

I think my program works in any Python 3, but I don't know Python versions quite well to tell this for sure. If you'll use some features only from new versions (including 3.6), that will be great and this solution should be accepted, but I don't think it's possible to come up with such.

I don't think we need any import. Well, actually, I don't think I am going to crack it anyway. My question is really "can we use the cmp() function which is only available in python 3.0.0?"

I'd say 'no', if I'm really allowed to put this restriction by the rules of the challenge.

@Wolfram You can restrict the version of python to whatever version you are running yourself. (run python3 --version to find out if you don't know)  So unless your intended solution only works in python3 version 3.0.0 you can prevent people from using cmp().

Cracked?

@Zgarb You got it, congrats :) (Only I didn't noticed one can glue 'for' and '2' together, so 1 bit more here.)

@Wolfram Ah, I miscounted the spaces. Fixing now for completeness.

Python 3, 46 bytes, cracked
lambda x:x*(1999888577766665//844333333222200)

Doubles the input.

How does 'Python' work in cops 'n robbers? May we choose an arbitrary version to attack your answer with?

Oh, this is Python 3 specifically, sorry. So / is float division.

Well, you just proved this challenge is not worth my time. Moving on.

Cracked: http://codegolf.stackexchange.com/a/107020/18535

7, 9 bytes, Cracked
This program's full of nonprintable characters, so here's a hexdump:
00000000: 2573 dc01 7e13 dcb6 1f                   %s..~....

Note: this uses a numeric input routine that's incapable of inputting negative numbers, so this submission is restricted to nonnegative integers only.
One problem with cops-and-robbers challenges is that you don't write explanations of the code (to make it harder to crack). On the other hand, this means that I don't have to go to to the trouble here.
I picked 7 as the language because, especially in its compressed notation, it's pretty hard to read, and I don't see why it should be only me who has to go to the trouble of moving around 8-bit chunks of programs written in a 3-bit encoding. Good luck!
Explanation
Now that the program's been cracked (by brute force, unfortunately; that's always a danger in these short solutions), I may as well explain what I was getting at. This was actually fairly solvable by reading the program; I could have made it much more difficult, but that felt like a bad idea when brute-force cracks exist.
We'll start by representing the program in a more natural encoding. As usual, bolded numbers indicate commands that run immediately (not all of which are representable in a program; 6 and 7 are but 2 to 5 aren't), unbolded numbers represent their escaped equivalents (0 to 5, all of which are representable in the original program; note that 0 is an escaped 6 and 1 is an escaped 7):

11271734002770236713303

The set of commands available in a 7 program source mean that it's basically just a literal that represents the original stack (there's nothing else you can do with just escaped commands, 6 and 7). So the first thing a program will do is push a bunch of stuff onto the stack. Here's how the stack looks after the program's run (| separates stack elements, as usual in 7):

772|7|34662|023|73363

The final stack element then gets copied to become the code to run (while remaining on the stack). As it happens, this is the only part of the program that's code; everything else is just data. Here's what it translates to:

73363
7      Push an empty element onto the stack
 3     Output the top stack element, discard the element below
73     Combined effect of these: discard the top stack element
  3    Output the top stack element, discard the element below
   6   Escape the top stack element, then append it to the element below
    3  Output the top stack element, discard the element below

In other words, this is mostly just a bunch of I/O instructions. Let's analyse this in detail:

73 discards the 73363 that's still on top of the stack.
3 outputs the 023, and discards the 34662. It can thus be seen that the 34662 is a comment, which was used to store the bytes needed in the other version of the program. As for what 023 does when output, it selects I/O format 0 (integers), then 23 is a directive which requests the implementation to input an integer (in 7, you do input via outputting specific codes that request input). The input is done by making copies of the stack element below, e.g. if the input integer is 10, the next stack element (currently 7) will become 7777777777. Thus, we're accepting input from the user in decimal, but it's being stored as unary.
6 escapes the top stack element (changing each instance of 7 to 1; this is how strings consisting entirely of 7s are escaped), then appends it to the stack element before (772). So our data is now something like 7721111111111.
Finally, 3 outputs the stack element in question (and pops a blank stack element that's part of the default initial stack). Its value is calculated by taking the number of 1s and 7s, and subtracting the number of 0s and 6s. (The 2 in the middle is ignored in most cases; if it's at the end of the string, it'll become a trailing newline instead of being ignored, but PPCG rules don't care about that.) Thus, the output is the original input plus 2.

At this point, there's nothing useful on the stack and nothing in the program, so the program exits.
How do we reverse this? It's a simple matter of changing the 11 to 00, so that we're prepending characters to the input that make it 2 lower, rather than 2 higher. There's a 00 conveniently hidden eight octal digits further on in the program (so that octal digits and bytes line up with each other), so we can simply swap it with the 11 at the start.

Cracked: http://codegolf.stackexchange.com/a/107103/18535

Side note: you don't have to explain your code, but knowing what your program does would be nice.

@GB: I gave a full explanation of the program (including an explanation of how the crack works).

JavaScript (ES6), 21 bytes, Cracked
This is an easy one.
b=>Math.pow(b,torc=3)

Returns the cube of the input.

Cracked

Python 2, 83 bytes, cracked
#((()))****+,,---/2289;==oppppppqqqqqw~~
lambda n:pow(n,65537,10998167423251438693)

This is similar to my other answer. However, this uses 64-bit RSA, and is cryptographically quite weak. If you can rob this answer, you can theoretically rob my other one as well, given enough time.

Cracked.

JavaScript (ES6), 46 bytes, Cracked
x=>Math.log(x+(+String(t=985921996597669)[5]))

This function returns ln(x+1) where x is a non-negative number.
Usage
(x=>Math.log(x+(+String(t=985921996597669)[5])))(5)

Note: Due to the nature of floating point numbers f(g(x)) may not exactly equal x. Example: f(g(4))=3.9999999999999996

Cracked. That was really fun :-)

Python 2, 47 bytes, Cracked
lambda x:x**2or (iron() and saxifrage.extend())

The domain for this function is {x ∈ ℤ | x > 0}.  It squares its input.

nmjcman101 found the intended solution:

 lambda x:sorted(a**2for a in range(x)).index(x)

Haha, love the made up function calls

Cracked That was fun, I got stuck on the sorted anagram I had left!

J, 8 bytes, cracked
Another simple one to start off with.
[:]+:[-:

Doubles the input.

How do we test this code?

@KritixiLithos https://tio.run/nexus/j#@x9tFattFa1r9f8/FwA

Cracked.

Processing.js, 59 bytes, Cracked!
float igetuwebaoli(int p){return p*(((17*-4*-3)))+0+0;}//,,

This function multiplies the input by 204 (17*-4*-3=204). It takes in an int as input and outputs a float. As expected, the inverse divides the input by 204.
An online interpreter for processing-js can be found here.

Cracked.

Processing (java), 59 bytes, SAFE
float igetuwebaoli(int p){return p*(((17*-4*-3)))+0+0;}//,,

This function multiplies the input by 204 (17*-4*-3=204). It takes in an int as input and outputs a float. As expected, the inverse divides the input by 204.
 Note: both programs take an int as input and output a float.
This answer is exactly the same as my other answer, except that my other answer was written in Processing.js. Meet Processing-java, the less verbose cousin of Java. You can download Processing here at processing.org.
The Crack
float ap(int i){return i*pow(blue(get(0,0)),-1);}//++7*4*-3

This program divides the argument by 204. But how? Let's go inside the function.
i *                              //multiply i by
         blue( get(0, 0) )       //this (evaluates to 204)
    pow(                  , -1)  //raises to the -1 power (ie its reciprocal)

Simple enough, but how does blue( get(0, 0) ) become 204? This is the centrepiece of this submission. First of all, get(0,0) gets the colour of the pixel located at (0,0) (the top left corner of the window, which always opens in a Processing sketch). Next, blue() gets the blue value of that pixel, which is 204!
To come up with this submission, I experimented by printing the different attributes of the colour obtained by get(0,0). I have found out that the red, green, blue, alpha values are 204, 204, 204 and 255 respectively. From this, I decided to do a simple operation with this number and ended up with this post.

I thought Kotlin was the less verbose cousin of Java! I do concede that the C family of languages is pretty big... but what would the family tree actually look like...

I believe you made it, no one has cracked your post and it's been a week.

J, 10 bytes, cracked
1%~<:[@*>:

Another simple one. Returns n2-1.

Cracked: http://codegolf.stackexchange.com/a/107106/18535

JavaScript (ES6), 15 bytes, cracked by Emigna
t=>(!!0+~~t+~0)

This functions returns n-1.

You can test it like:
(t=>(!!0+~~t+~0))(6)

Cracked
My intended solution is a bit different than Emigna's crack:

 t=>t+(+!!~~~00)

Cracked

J, 29 bytes (Cracked by miles)
5#.[:,(3 5&#:(-$]-)7)#.inv"0]

This is a verb that takes a positive integer as input, and does the following:

Convert to bases 2 and 4.
Pad the base-4 representation with 0s to have the same length as the base-2 representation.
Concatenate the two representations (base-2 first).
Interpret the concatenation as a base-5 representation and convert to integer.

Try it online!
My solution
The logic is pretty much the same as in the crack.
The rank conjunction " can be stuck in many different places (and I use it to get rid of the unnecessary 0 and 3), since it doesn't really do anything in the solution.
(7-5)#.[:(]-:&#$,)5#.inv"0 3]

I don't understand J, but my experiments show this actually takes integer in bases 2 and 4, adds zeros to the end of base 4 to make their length equal, and only then concatenates. Are these zeros intended?

@Wolfram The zeros are intended, that's what I tried to say with "simultaneously". Otherwise I don't think it would be reversible.

@Wolfram I added a more explicit description.

Cracked.

Brain-Flak, 26 bytes, Cracked
Original
((((()()())){}[()]){}{}{})

My Crack

 ([(((()())){}()){}{}()]{})

1000000000's Crack

 ([(((()())()){}){}{}](){})

Cracked

JavaScript (ES6), 63 bytes Cracked by Ilmari Karonen
x=>eval(atob`eCp4KzEvLyAgfXBModLS4TvEn4wp1iys9YRRKC85KLIhNMC=`)

Time for some atob nonesense. This function returns x*x+1 where x is a non-negative number.
Usage
(x=>eval(atob`eCp4KzEvLyAgfXBModLS4TvEn4wp1iys9YRRKC85KLIhNMC=`))(5)

Intended

x=>eval(atob`Lyp5fMRwICAgKi9NYXRoLnBvdyh4LTEsMC41KS8veCp4KzE=`)

There's a large number of potential solutions, but I was hoping that the leading characters would throw off the byte order enough to make this harder. C'est la atob

Cracked.

Did you just accidentally repost your challenge code as the intended solution? :)

@IlmariKaronen Thanks, that'll teach me to copy/paste... lol yeah right :P

Python 2, 225 bytes, cracked by Sp3000
#((()))****+,,---/000555666888;==oppppppqqqqqw~~
lambda n:pow(n,65537,9273089718324971160906816222280219512637222672577602579509954532420895497077475973192045191331307498433055746131266769952623190481881511473086869829441397)

Domain of this function is [0, n), where n is the huge number above. Yes, this function is invertible on this domain. And unless I messed up, breaking this answer is as hard as breaking 512 bit RSA.

Brute-forcing this is considerably easier than brute-forcing RSA because you already have an approximate anagram of the constant you need. On the other hand, it's likely still too difficult to manage in practice.

@ais523 If you are interested, check out my other answer. It should be manageable.

Keep in mind that there is a meta post regarding randomisation in CnR challenges: http://meta.codegolf.stackexchange.com/questions/10793/add-randomization-in-cnr-posts-as-a-loophole

@KritixiLithos My answer does not contain randomization, hashes or builtin crypto code. It's literally one modular exponentiation.

Your answer intendedly aims at a problem known to be hard to solve and therefore matches the meta post (especially since it mentions RSA directly). I think that even if you meta loophole your script still deserves my downvote.

Cracked

If it requires brute-forcing to solve, it's not in the spirit of the challenge.

J, 15 bytes
(".&,'10.')#.#:

Takes a non-negative integer n, converts it to a list of binary digits, and combines those digits as a base 10 number.
Try it online!


text:
Hidden Inversions (Robbers' Thread)
This is a cops-and-robbers puzzle, the cops' thread can be found here.
Your task will be to find an anagram of the provided programs in the cops' thread that performs its left inverse.
Once you crack an answer post the solution as an answer below and notify the original answerer.
You will be scored on the number of programs you are the first to crack.

Python 3, 46 bytes, Lynn
lambda x0223334566789:(x0223334566789*89)//178

How do I "notify the original answerer"?

Left a comment linking your answer on the original

You should drop the f= at the start of your code since its not needed and not part of the original function

Done, I just copy-pasted it too quickly.

Here I am actually brute forcing a solution (and even assuming one exists) and you just sidestep the entire problem! +1

Very well done :)

I had thought of adding numbers to be part of the variable, but I still decided there were too many combinations for me to look into it.

I moved all of them and was left with 1, 7 and 9, then started thinking of possible connections.

Python 2, 225 bytes, orlp
p=90930641353124136621573325641513715557077985927835294018496194596645372722158;q=101979812089012306249375934082966806799688507587087308196267706260111970225882#--223444799
lambda n:pow(n,pow(65537,(p*q-2*(p+q))/4,p*q),~p*~q)

Guess I got lucky after guessing random prime divisors all day...

(Default c4.8xlarge spot limit is 4, but I managed to bump it to 10 last year. Had to tweak the FAAS config from 16 slaves to 6 though (+3 mpi, 1 master). 20m polyselect, 12h 50m sieving, 2h 25m linalg, 30m sqrt. Total cost ~$70. At least @orlp was nice enough to pick a solvable size, but I'm not doing this again! Thanks to @IlmariKaronen for the last step, and yes I'm joking about the guessing :P)

I.. what... Now I feel bad for costing you money :( I intentionally picked a size that would still be reasonably small but too high a cost to attack. I didn't actually think anyone would spend money on this.

@orlp Totally worth it as a one-off experience for me. I hope people learn something about 512-bit RSA security in the wild from this :)

This is real dedication to golfing, spending not only time but money! Interesting to note that an attacker could potentially break 512-bit RSA for free via cloud compute service trials.

@miles I should mention that AWS has credit for students if anyone wants to try, and I wouldn't be surprised if other services did the same. Hence you're probably not far off with that trials idea, at least for the first time. (If anyone wants to try though - make sure you delete all volumes, AMIs, etc. once you're done because otherwise you'll be charged for storage)

Python 2, 83 bytes, orlp
Original:
#((()))****+,,---/2289;==oppppppqqqqqw~~
lambda n:pow(n,65537,10998167423251438693)

Crack:
p=3207399658;q=3428998126#--11
lambda n:pow(n,pow(65537,(p*q-2*(p+q))/4,p*q),~p*~q)

Try it online!
RSA cracking done by Wolfram Alpha. ;)

I just realized ~p*~q is straight up shorter than -~p*-~q, oops.

How did you reverse engineer the (p*q-2*(p+q))/4 part though? :)

That was the trickiest part, wasn't it? Basically, knowledge of the Carmichael function and the fact that p/2 and q/2 were both odd primes, and a bunch of trial and error to find something that would work using the available characters.

I intentionally chose p and q (the real ones, the one in the code are p-1 and q-1 for golfing purposes) such that (p-1)/2 is prime so that we have φ(φ(pq)) = ((p-1)/2-1)((q-1)/2-1). This allows us to compute the modular inverse of 65537 mod φ(pq) (what we need for RSA) using Euler's identity, making the answer a lot shorter because we don't need to implement modular inverse logic or hardcode another large constant. Apart from the -~q*-~p -> ~q*~p, you found exactly my function :)

Actually, to pick a minor nit, I believe φ(φ(pq)) = 2((p-1)/2-1)((q-1)/2-1) for safe primes p and q, because φ(4) = 2. But λ(φ(pq)) = lcm(2, (p-1)/2-1, (q-1)/2-1) is at most ((p-1)/2-1)((q-1)/2-1)/2, and any multiple of that, minus one, will do for the exponent. :)

Nope. I literally answered the same question a couple hours ago. :) In that explanation we have p' = (p-1)/2 and vice versa for q'.

Actually, now that I read more carefully, φ is only multiplicative when the factors are coprime. So it seems that I messed up. Or did I? I'm not entirely sure. EDIT: I definitely messed up at φ((p-1)(q-1)) = φ(p-1)φ(q-1). (p-1)(q-1) aren't coprime.

Python 3, 80 bytes, Wolfram
from bisect import*
q=int(input())
print(bisect([(h+1)**2 for h in range(q)],q))

This was really hard to crack!
I use the bisect library, which is included in the Python 3 distribution.
The bisect function takes a sorted list and an element, and returns the rightmost index where the element could be inserted to maintain order.
We just give it the length-q list of squares starting from 1 and the element q.

I was going to suggest changing (h+1) to -~h. Then I realized that that's not the point of this challenge :P

@ETHproductions That'd be incorrect anyway due to operator precedence.

@Sp3000 Huh, I had no idea that ** has higher precedence than ~ in Python. I suppose that's better than in JS, where -~2**2 throws a syntax error ("unparenthesized unary expression can't appear on the left-hand side of '**'").

@ETHproductions They actually did that to avoid ambiguities, which, as I might add, is very uncharacteristic of most JS design.

@Challenger5 Actually, I'd have to disagree with you there: in recent years TC39 has been extremely careful to make sure any new features added are as completely free of ambiguities as possible (which includes the ** operator, added in ES2017)

@ETHproductions Correction: In the relatively small and simple subset of ES that I use, there seems to be very little consideration to making it unambiguous, which, given what you have pointed out, is probably just because of backwards compatibility.

Javascript, 21 bytes, Arnauld
Original
b=>Math.pow(b,torc=3)

Crack
o=>Math.cbrt(o,pbw=3)

Returns the cube root.

There you go! ;)

@Arnauld: I find it a bit weird that JS allows you to call functions with more arguments than they're defined for. I wonder what the thought behind that is.

You're right, JS allows that by design. Extra arguments are not completely lost, though, since they're stored in the arguments object which may be manually accessed by the function.

7, 9 bytes, ais523
00000000: 0173 dc25 7e13 dcb6 1f                   .s.%~....

Because brute force always wins, and 9! is only 362880

Processing.js, 59 bytes, Kritixi Lithos
Original:
float igetuwebaoli(int p){return p*(((17*-4*-3)))+0+0;}//,,

Crack:
int loabewuteg(float p,i){return (i+0**+0,(p/17/(-4*-3)));}

Well, that was easy enough.  The hardest part was figuring out where to stick the extra commas and asterisks.  Fortunately, it seems that Processing allows extra unused function parameters as well as C-style comma expressions.

Apparently, the interpreter I linked was wrong. In fact, most (or even all) online interpreters are probably going to be wrong since Processing-java gets pre-compiled to Processing.js. Right now, I think the best course of action would be for me and you to change our answers to "Processing.js" instead of Processing because then your answer would be valid (Processing-java gives tons of errors). I will post a separate answer with the same code as Processing-java, but for this the nest interpreter would be to install it from processing.org. Well done anyways!

JavaScript (ES6), 63 bytes, SLuck49
Original:
x=>eval(atob`eCp4KzEvLyAgfXBModLS4TvEn4wp1iys9YRRKC85KLIhNMC=`)

Crack:
x=>eval(atob`CgpNYXRoLnBvdyh4LTEsMC41KSAvLw4589CEIKKMRefipyz=`)

The base64 code above decodes to:

Math.pow(x-1,0.5) //...

where the ... stands for a bunch of random garbage that is ignored by the JS interpreter, since it's in a comment.
I found this solution by trial and error.  In the end, the only really tricky part were the two newlines at the beginning of the code, needed to make the rest line up properly and to get the M in Math to base64-encode into something that was available in the original character set.  I first tried spaces, but "  M" base64-encodes into "ICBN" and I needed the only available B to encode ".po" later in the code.  "0+M", "1*M", "1?M" or any other similar no-op prefixes I could think of didn't work either, but newlines did.
I suspect this may not be exactly the intended solution, but whatever — it works. :)
Demo:

var f = x=>eval(atob`eCp4KzEvLyAgfXBModLS4TvEn4wp1iys9YRRKC85KLIhNMC=`)
var g = x=>eval(atob`CgpNYXRoLnBvdyh4LTEsMC41KSAvLw4589CEIKKMRefipyz=`)
for (var i = -0; i <= 10; i++) console.log(i, '->', f(i), '->', g(f(i)))

Good job finding something that worked, I had hoped putting the extra characters at the start would make this a little harder

Impressive :) I took the exact same approach but didn't think to try newline. I was trying to lose a C elsewhere but was getting nowhere.

JavaScript (ES6), 46 bytes, SLuck49
Original (calculates ln(x+1))
x=>Math.log(x+(+String(t=985921996597669)[5]))

Crack
x=>Math[(lg=19979699+55686).toString(9+25)](x)

I never would have cracked this if I hadn't realized that the inverse is a Math built-in. (lg=19979699+55686).toString(9+25) is just a convoluted way of returning "expm1".

Nicely done! Yeah I was looking through the functions on Math to decide what to use, saw expm1, and said "Wait, that's a thing?"

Brain-Flak, 26 bytes, Wheat Wizard
Original (adds 13)
((((()()())){}[()]){}{}{})

Crack (subtracts 13)
([(((()())()){}){}{}](){})

J, 8 bytes, miles
[:]-:[+:

Simple swapping of +: for -: (double for halve).

Also you can swap the left and right verbs: [:[+:]-:.

Javascript, 15 bytes, insertusernamehere
Original
t=>(!!0+~~t+~0)

Crack
t=>(~~!!~0+t+0)

Nicely done. I had something different in mind. :D

Python 2, 47 bytes, Wheat Wizard
lambda x:sorted(a**2for a in range(x)).index(x)

Good job! You found the exact solution I had in mind

J, 10 bytes, miles
1%:@*~>:[<

I have to write something here because the answer is too short.

J, 29 bytes, Zgarb
Original
5#.[:,(3 5&#:(-$]-)7)#.inv"0]

Crack
[:(](07-5)"3 #.-:&#$,)5#.inv]

Try it online!
Another crack equivalent is
[:((3 ]7-5)#.-:&#$,)5#.inv"0]

Explanation
[:(](07-5)"3 #.-:&#$,)5#.inv]  Input: integer n
                            ]  Get n
                      5        The constant 5
                       #.inv   Get the digits of n in base 5
[:(                  )         Operate on those digits D
                    ,            Flatten D (does nothing since it is already a list)
                  #              Get the length of D
               -:&               Halve it
                   $             Reshape D to half its length (only the base 2 digits)
    (07-5)"3                     The constant 2 with rank 3
             #.                  Convert the front-half of D to a decimal from base 2
   ]                             Return the right result

Yep, that works! It's a bit different from my solution, but there's a lot of leeway. The basic logic is the same though.


text:
Numbers x such that x^2 divides 7^x-1
Task
There is a set of numbers x, such that x^2 divides 7^x-1.
Your task is to find these numbers. Given an input of n, the code will print the nth number that follows this rule.
Examples 1-index
In   Out
3    3
9    24
31   1140

The relevant sequence can be found here.
Rules
Shortest answer will be the winner*
Standard golfing rules apply
Loopholes are not allowed
Your answer can either be 0 or 1 indexed, please state in your answer

@nimi I wrote these down when planning and never implemented them. I've updated the question

What are the limits of n? I can give the correct result with n=9, but n=10 is already causing me problems.

@briantist If you're getting the wrong result for higher input values, your answer is wrong. If it's just taking a long time, that can be implementation dependent.

It's not just taking a long time. n=10 gives me 32; it's because it starts using double instead of integers and the mod is wrong after that. :(

Haskell, 34 bytes
([x|x<-[1..],mod(7^x-1)(x^2)<1]!!)

This uses 0-based indexing. Usage example: ([x|x<-[1..],mod(7^x-1)(x^2)<1]!!) 30 -> 1140.
It's a direct implementation of the definition. It builds a list of all numbers x and picks the nth.

Pyth, 10 bytes
e.f!%t^7Z*

A program that takes input of an integer and prints a one-indexed value.
Try it online!
How it works
e.f!%t^7Z*     Program. Input: Q
e.f!%t^7Z*ZZQ  Implicit variable fill
               Implicitly print
e              the last
 .f         Q  of the first Q positive integers Z
     t^7Z      for which 7^Z - 1
    %          mod
         *ZZ   Z^2
   !           is zero

JavaScript (ES7), 40 bytes
f=(n,i=1)=>n?f(n-!((7**++i-1)%i**2),i):i

This loses precision fairly quickly due to the fact that JS loses precision by 7**19. Here's a nearly arbitrary-precision ES6 version:
f=(n,i=0)=>n?f(n-!(~-(s=++i*i,g=j=>j?g(j-1)*7%s:1)(i)%s),i):i

This finishes within about a second for test case 31.
A few longer approaches:
f=(n,i=0)=>n?f(n-!(~-(s=>g=j=>j?g(j-1)*7%s:1)(++i*i)(i)%s),i):i
f=(n,i=0)=>n?f(n-!(s=++i*i,g=(j,n=1)=>j?g(j-1,n*7%s):~-n%s)(i),i):i
f=(n,i=0)=>n?f(n-!(s=>g=(j,n=1)=>j?g(j-1,n*7%s):~-n%s)(++i*i)(i),i):i

05AB1E, 11 bytes
µ7Nm<NnÖiN¼

Try it online!
For some reason I can't get ½ to work in µ7Nm<NnÖ½N or I'd be tied with Pyth.
µ           # Loop until the counter equals n.
 7Nm<       # Calc 7^x+1.
     Nn     # Calc x^2.
       Ö    # Check divisibility.
        iN¼ # If divisible, push current x and increment counter.
            # Implicit loop end.
            # Implicitly return top of stack (x)

.

Yeah, I've had that quirk with Ö on my fix list for months but I never get around to dealing with it. Anyways, you don't need the N as µ automatically outputs the last N if the stack is empty.

Python 2, 48 46 bytes
Thanks to @Dennis for -2 bytes!
f=lambda n,i=1:n and-~f(n-(~-7**i%i**2<1),i+1)

A one-indexed recursive function that takes input via argument and returns the result.
Try it online! (Recursion limit increased to allow the final test case to run)
How it works
n is the desired index, and i is the counting variable.
The expression ~-7**i%i**2<1 returns True (equivalent to 1) if i^2 divides 7^i - 1, and False (equivalent to 0) otherwise. Each time the function is called, the result of the expression is subtracted from n, decrementing n each time a hit is found; i is also incremented.
The short-circuiting behaviour of and means that when n is 0, 0 is returned; this is the base case. Once this is reached, recursion stops, and the current value of i is returned by the original function call. Rather than explicitly using i, this is done using the fact that for each function call, an increment has been performed using the -~ in front of the call; incrementing 0 i times gives i, as required.

(~-7**i%i**2<1) saves a couple of bytes.

@Dennis Of course! Thanks.

Python 2, 57 53 51 bytes
-4 bytes thanks to ETHproductions
-2 bytes thanks to TuukkaX
i=0
g=input()
while g:i+=1;g-=~-7**i%i**2<1
print i

Try it online!
the sequence is 1-indexed

@ETHproductions yep c:

Does a testcase fail if you remove the parentheses around (7**i)? I removed them and it worked for the ones I tried.

@TuukkaX indeed, ** has a higher precedence than ~ and -

Mathematica, 43 bytes
I've currently got three different solutions at this byte count:
Nest[#+1//.x_/;!(x^2∣(7^x-1)):>x+1&,0,#]&
Nest[#+1//.x_/;Mod[7^x-1,x^2]>0:>x+1&,0,#]&
Nest[#+1//.x_:>x+Sign@Mod[7^x-1,x^2]&,0,#]&

What is the character between x^2 and (7^x... in the first line? It looks like a pipe but shorter

@Sefa It's the Unicode character for the mathematical "divides" symbol and is used by Mathematica as an operator for Divisible.

Here is one at 41 Bytes: Cases[Range[#^3],x_/;x^2∣(7^x-1)][[#]]& based on the heuristic argument that n^3 is an upper bound. I have discovered a truly marvelous proof of this, which this margin is too narrow to contain :)

PARI/GP, 42 bytes
Pretty straightforward. 1-indexed, though this could easily be changed.
n->=k=1;while(n--,while((7^k++-1)%k^2,));k

or
n->=k=1;for(i=2,n,while((7^k++-1)%k^2,));k

Python 2, 57 bytes
This takes a really, really long time for large values. It also uses plenty of memory, because it builds the entire list way farther than necessary. The result is zero-indexed.
lambda n:[x for x in range(1,2**n+1)if(7**x-1)%x**2<1][n]

Try it online

out of curiosity, is there any proof for the 2**n+1 as upper limit?

@Rod Not that I know of, but considering that there are 50 values < 5000, I'm sure there's a lot more than 50 < 2**50. I could use 9**n+9, but it takes much much longer. I started running f(20) a while ago (with 2**n+1); it still hasn't completed.

I don't even think there's a proof that the sequence is infinite, let alone a nice upper bound for the nth term!

R, 35 bytes
This only works for n<=8.
z=1:20;which(!(7^z-1)%%z^2)[scan()]

However, here's a longer version which works for n<=25, for 50 bytes:
z=1:1e6;which(gmp::as.bigz(7^z-1)%%z^2==0)[scan()]

Does this only work up to 8 because it become a long int?

@george Yes, you lose accuracy as R defaults to 32 bit integers. The second version of the code uses a package, gmp, which allows arbitrarily large integers. However, I rapidly run out of RAM for computing anything above n=25.

Python 3, 45 bytes
f=lambda n,k=2:n<2or-~f(n-(7**k%k**2==1),k+1)

Return True for input 1, which is allowed by default.
Try it online!

I can't test this at the moment, but I assume it returns a value for other inputs? Rather than a bool?

Pyke, 10 bytes
~1IX7i^tR%

Try it here!
~1         -  infinite(1)
  IX7i^tR% - filter(^, not V)
    7i^    -    7**i
       t   -   ^-1
        R% -  ^ % v
   X       -   i**2
           - implicit: print nth value

Clojure, 83 bytes
(fn[n](nth(filter #(= 0(rem(-(reduce *(repeat % 7N))1)(* % %)))(iterate inc 1N))n))

Try it online!
This builds an infinite list of Java BigIntegers starting at 1 and filters them by the definition. It uses zero-based indexing to select the nth value from the filtered list.

Perl 5, 35 Bytes
Well, this was missing, so here it is:
map{$_ if!((7**$_-1)%($_**2))}1..<>

Powershell, too many bytes
Just to see if it was possible and it is.
[System.Linq.Enumerable]::Range(1,10000)|?{[System.Numerics.BigInteger]::Remainder([System.Numerics.BigInteger]::Pow(7,$_)-1,$_*$_) -eq 0}

QBIC, 39 bytes
:{~(7^q-1)%(q^2)=0|b=b+1]~b=a|_Xq\q=q+1

I couldn't get it to run in QBasic 4.5, but it seems to run fine in QB64. For some inexplicable reason, QBasic refuses to cleanly divide 13,841,287,200 by 144, but instead gives a remainder of -128. It then returns 16 as the 7th term of this sequence instead of 12...
:{      get N from the command line, start an infinite DO-loop
~       IF
(7^q-1) Part 1 of the formula (Note that 'q' is set to 1 as QBIC starts)
%       Modulus
(q^2)   The second part
=0      has no remainder
|b=b+1  Then, register a 'hit'
]       END IF
~b=a    If we have scored N hits
|_Xq    Quit, printing the last used number (q)
\q=q+1  Else, increase q by 1.
        [DO-loop and last IF are implicitly closed by QBIC]

Wonder, 28 bytes
@:^#0(!>@! % - ^7#0 1^#0 2)N

Zero-indexed. Usage:
(@:^#0(!>@! % - ^7#0 1^#0 2)N)2

Filters from the list of natural numbers with a predicate that determines whether x^2 is divisible by 7^x-1, then gets the nth item in that list.

Perl 6, 35 34 bytes
{grep({(7**$_-1)%%$_²},^∞)[$_]}

0-indexed.
Shaved off one byte thanks to Brad Gilbert.

grep is a subroutine so you can remove the space if you put the parens after it {grep(…)}

PHP, 47 49 bytes
while($n<$argv[1])$n+=(7**++$x-1)%$x**2<1;echo$x;

Only works for n<9 (7**9 is larger than PHP_INT_MAX with 64bit)
62 bytes using arbitrary length integers: (not tested; PHP on my machine doesn´t have bcmath)
for($x=$n=1;$n<$argv[1];)$n+=bcpowmod(7,++$x,$x**2)==1;echo$x;

Run with php -nr '<code>' <n>.
pseudo code
implicit: $x = 0, $n = 0
while $n < first command line argument
    increment $x
    if equation is satisfied
        increment $n
print $x

Tcl, 73 bytes
while {[incr i]} {if 0==(7**$i-1)%$i**2 {incr j;if $j==$n break}}
puts $i

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Springify a String
Sandbox post here.
Create a function or program that "Springifies" a string.

Input will be a String in Stdin, or closest alternative
Input will only contain printable ASCII and/or spaces
Output will be to Stdout, or closest alternative
A trailing newlines and spaces are acceptable

How to springify a String

Format the String into as many ASCII spring coils as needed
Pad the coils with spaces, up to the nearest coil
Read off the characters, following the spring around the coils

This is an ASCII spring coil:
#
# ####
 #    #
# ####
#

Where the #s are the characters of the String
Here is an example:
abcdefghijklmnopqrstuvwxyz
becomes
a
b cdef
 g    h
i jklm
n
o
p qrst
 u    v
w xyz.
.

Where the .s replace spaces for visibility.
Then, the string is read back, following the ASCII spring downwards, around the loops, hitting the g and u twice:
1| a  <-3
 V b cdef
    g    h
4| i jklm
 V n  2->
  ...

...giving:
abgjklmhfedcginopuxyz vtsrquw (with a trailing space)
Test Cases
(quotations added to highlight trailing spaces - please ignore in terms of IO)
I: "abcdefghijklmnopqrstuvwxyz"
O: "abgjklmhfedcginopuxyz vtsrquw "

I: "!@#"
O: "!@         #   "

I: ""
O: ""

I: "12345 67890"
O: "12690  7 54368 "

I: " "
O: "               "

Note that the output length is always a multiple of 15, the length of a spring coil
This is code-golf, so the shortest answer in bytes wins.

I feel like it would've been much more of a challenge to follow the pattern along the coil.

@carusocomputing you mean the inverse?

http://codegolf.stackexchange.com/a/107531/59376 turns out I didn't understand the challenge as written, that's exactly the challenge ahaha.

Jelly, 26 bytes
“4ṘƝ;þ¦Ɱ’b®¤ị
;⁶x14©¤s®ṖÇ€

TryItOnline!
How?
“4ṘƝ;þ¦Ɱ’b®¤ị - Link 1, output for a single coil: char array
           ¤  - nilad followed by link(s) as a nilad
“4ṘƝ;þ¦Ɱ’     - base 250 number, 13140239220751650
          ®   - retrieve from register (14 from main link)
         b    - convert to base, [1,2,7,10,11,12,13,8,6,5,4,3,7,9,0]
            ị - index into the char array

;⁶x14©¤s®ṖÇ€ - Main link: theString
      ¤      - nilad followed by link(s) as a nilad
 ⁶           - a space character
  x          - repeated
   14©       - place 14 into the register and yield 14
;            - concatenate theString with the 14 spaces
       s     - split into chunks of length
        ®    -     retrieve from register (14)
         Ṗ   - pop last entry from the result (removes the space only last entry of 14 chars or less)
          Ç€ - call the last link (1) as a monad for €ach
             - implicit print

Python 2, 104 102 98 Bytes
f=lambda t:''.join((t+' '*13)[ord(x)-97+y*14]for y in range(len(t)/14+1)for x in'abgjklmhfedcgin')

Thanks for the comment help!
https://tio.run/#2VDVy
Original:
t=raw_input()+' '*13
print''.join(t[ord(x)-97+y*14]for y in range(len(t)/14)for x in'abgjklmhfedcgin')

You can just use input() and take input in the format "<stuff>".

Great first golf! As Alex L. points out, we allow input to be taken in quotes. You can also use a lambda to give an anonymous function rather than a program -- this is often shorter.

Fails for the empty string test case with an IndexError. I think you may need to change 13 to 14 and pop off the final value (much like my Jelly answer).

...changing the +13 to +14 and the +1 to +(len(t)%14>0) would do it, but there must be a shorter way.

JavaScript (ES6), 79 bytes

f=
s=>s.replace(/.{1,14}/g,s=>'0169abc7543268d'.replace(/./g,c=>s['0x'+c-0]||' '))
<input oninput=o.textContent=f(this.value)><pre id=o>

Hexadecimal string shamelessly stolen from @ETHproductions.

@ETHproductions Thanks, fixed.

That's brilliant!

It's nice how the snippet lets you see the result as you type it

JavaScript (ES7), 144 143 141 114 104 103 bytes
Thanks to ETHProductions for a 10B save!
a=>[...b=a+' '.repeat(15-a.length%15)].map((_,c)=>b['0x'+'0169abc7543268d'[c%15]-0+(c/15|0)*14]).join``

Example
f=a=>[...b=a+' '.repeat(15-a.length%15)].map((_,c)=>b['0x'+'0169abc7543268d'[c%15]-0+(c/15|0)*14]).join``
f('abcdefghijklmnopqrstuvwxyz')

Output
abgjklmhfedcginopuxyz vtsrquw

Very nice. You can save some bytes by converting the array to a hexadecimal string, and using +('0x'+whatever) to convert it to a number: (_,c)=>b[(c/15|0)*14+ +('0x'+'0169abc7543268d'[c%15])]

Clever trick. I was already thinking of other ways to write the array, but I couldn't come up with any. I can still shorten that, by placing the hexadecimal number first and then the multiplication, making the space needless.

You could even do '0x'+'...'[c%15]-0+(c/15|0)*14 to save yourself a pair of parentheses :-)

You're right. Added.

Retina, 71 bytes
$
13$*
M!`.{14}|$
(.)(.)(.)(.)(.)(.)(.)(....)(.)¶
$5$8$6$4$3$2$1$5$7$9

Try it online!
Permuting strings isn't exactly concise in Retina...

Perl 6, 61 bytes
{S:g/(.)**1..14/{[~] $0["abgjklmhfedcgin".ords X-97]X//" "}/}

How it works
The basic structure is this:
{                                  }  # A lambda.
 S:g/(.)**1..14/{                }/   # Regex-replace segments of 1-14 characters, with:
                     $0               #   The single-char submatches captured by the parens.
                       [  ]           #   Index them using certain indices (see below).
                           X//" "}    #   Replace each undefined element with a space.
                 [~]                  #   Concatenate the characters.

The expression used to index into each 14-characters segment is "abgjklmhfedcgin".ords X- 97, which works as follows:

Take the hard-coded string abgjklmhfedcgin.
Get its codepoints: 97 98 103 106 107 108 109 104 102 101 100 99 103 105 110.
Subtract 97 from each number: 0 1 6 9 10 11 12 7 5 4 3 2 6 8 13.

Perl 6, 64 bytes
{[~] .comb(14)».comb»[0,1,6,9..12,7,5...2,6,8,13].flat X//" "}

Try it online!
How it works
The basic structure is this:
{                                    }  # A lambda.
     .comb(14)                          # Split the argument into substrings of <= 14 chars.
              ».comb                    # Split each substring into a list of characters.
                    »[  ]               # Index each list using the same indices (see below).
                         .flat          # Flatten the resulting nested list.
                               X//" "   # Replace each undefined element with a space.
 [~]                                    # Concatenate the list to get a string again.

Same indices as above, but since we're calling .flat anyway, we can use a nested (but 1 byte shorter) expression for them: 0,1,6,9..12,7,5...2,6,8,13.
(Looks trivial, but actually relies on a parsing peculiarity of Rakudo Perl 6 that is probably a bug. To write it without exploiting that bug, one would have to add parens around the 5...2.)

Befunge-93, 97 bytes
<>0>v%2g3\p89:-1+*"!"!:+1<_@#`0:~
,^\,_\:98g\9p1+:76+`#v_:~^
^,,g96g98g9+67,,,,,$$_
==    =  ====

Try it online!
This is a breakdown of the source code with the various component parts highlighted.

 The main loop starts off executing right to left, wrapping around to the right hand side of the playfield. This is where we read the first character from stdin, and terminate if it's an EOF.
 The next section makes sure any EOF characters are converted to spaces using the formula c = c + 31*!(c+1). Although this won't apply on the first iteration, it can occur on subsequent passes.
 A copy of the character is saved to temporary memory, and then a lookup of the current index is performed on the table on line four () to determine whether the character should be output or not.
 If the character needs to be output, we take the left branch. A swap is performed here to cancel out the swap that's going to occur next, and then a zero is pushed to force the branch right.
 If the character wasn't output, we swap it down the stack beneath the index counter (this is the swap that gets cancelled in the left branch). And in both cases we save the character to memory at the current index offset, increment the index, and check if it's greater than 13.
 If not, we read the next character from stdin and repeat the inner loop.
 If it is, we'll have finished a set of 14 characters, 7 having been output (abgjklm), and 7 remaining on the stack (cdefhin). We drop the last two, output the remaining 5 (hfedc), and then retrieve and output the special cases g, i and n from memory.
 And that brings us back to the start of the main loop, where we repeat the process again for the next 14 characters.

Nice explanation, well done

Mathematica, 77 72 bytes
Thanks to JungHwan Min for saving 5 bytes!
Join@@Partition[#,14,14,{1,1}," "][[;;,LetterNumber@"abgjklmhfedcgin"]]&

Unnamed function taking a list of characters as input and returning a list of characters. Partition[#,14,14,{1,1}," "] splits the input into sublists of length 14, padding with spaces if necessary. LetterNumber@"abgjklmhfedcgin" evaluates to {1,2,7,10,11,12,13,8,6,5,4,3,7,9,14}, which indicates the order to take each length-14 sublist in (repeating the 7th element appropriately). Then [[;;,...]] takes the elements of all the length-14 sublists in that order, and Join@@ joins the answers together.
Previous submission:
Join@@Partition[#,14,14,{1,1}," "][[All,83224017339955102~IntegerDigits~16]]&

LetterNumber@"abgjklmhfedcgin" is a shorter way to compress the list. Also ;; instead of All saves a byte.

Great suggestions!

Python 3, 86 bytes
lambda s:''.join(t[i%14]for t in zip(*[iter(s+' '*13)]*14)for i in b'Tq>]zQ|1/X;:L$o')

Try it online!
As a bonus, the string Tq>]zQ|1/X;:L$o is a valid CJam program that prints the unique characters on standard input, sorted. Try it online! (+ explanation)

PHP, 94 bytes
foreach(str_split($argv[1],14)as$s)for($i=0;$c=abgjklmhfedcgin[$i++];)echo$s[ord($c)-97]??" ";

splits command line argument to 14-byte chunks and loops through the translation string as index for the sub-string. Run with php -nr '<code>' <string>.
I was glad to find out that ?? also accepts the empty string (for an "invalid" index) as null.

Ruby, 83 bytes
->s{v="";(s+" "*13).scan(/.{14}/){|y|"0169:;<7543268=".chars{|o|v+=y[o.ord-48]}};v}

First idea was using hex numbers, but ord-48 saves another byte (stolen from throx's answer).