text:
Two First Names
A person has two first names if their last name is also a common first name. You are tasked with determining which full names in a list are two first names.
John Smith
John Doe
Luke Ryan
Ryan Johnson
Jenna Jackson
Tom John

Any name that occurs in the first name column is potentially a first name. If the number of occurrences of the name in the first name column is greater than the number of occurrences in the last name column, it is definitely a first name.
In the above list, John appears twice in the first names and once in the last names so it is definitely a first name. Ryan appears once in the first and once in the last so it is (probably) a first name.
Therefore, Tom John definitely has two first names and Luke Ryan probably does.
Given the above list, your code should output the follow:
Luke Ryan has two first names
Tom John definitely has two first names

Input
As mentioned above, your code will take in a list of full names (from standard input, one per line) separated by spaces. Names can include hyphens or apostrophes, but you will never be given a first or last name that includes spaces (ie no Liam De Rosa, but Liam De-Rosa or Liam De'Rosa are fair game. In other words, names will match [-'A-Za-z]+.
Each full name will be unique (ie John Smith will not appear twice).
Output
Print full names names (once per line) followed by either has two first names or definitely has two first names if they meet the criteria above. Names should only be printed once.
Names that are not two first names do not need to be printed.
You must preserve the case and special characters of the name.
Examples
Input
Madison Harris
Riley Hudson
Addison Hills
Riley Phillips
Scott Hill
Levi Murphy
Hudson Wright
Nathan Baker
Harper Brooks
Chloe Morris
Aubrey Miller
Hudson Lopez
Samuel Owen
Wyatt Victoria
Brooklyn Cox
Nathan Murphy
Ryan Scott

Output
Riley Hudson definitely has two first names
Ryan Scott has two first names

Input
Owen Parker
Daniel Hall
Cameron Hall
Sofia Watson
Mia Murphy
Ryan Jones
Emily Ramirez

Output
[no output]

Input
Olivia Robinson
Jacob van-Dyke
Jacob Ella
Brayden De'Rosa
Levi Brook
Brook Bella
Ella Hill
Ella Anderson
Brook-Anne van-Dyke

Output
Jacob Ella definitely has two first names
Levi Brook has two first names

Notes and Scoring

This is code golf. Lowest score (bytes) wins.
standard loopholes apply.

Good luck!

Does Johnson count as John, or is it different?

Johnson would be different than John. Names must match exactly.

How we choose between definitely has two first names and has two first names ? It can be always one of those?

Only display definitely if the the name occurs more times in the first-name column than the last-name column. This case overrides, so only display definitely has two first names. Check out the examples.

How flexible is input format? Can it be an array of strings, one per person? Or a 2D array of strings?

Do we have to print the names in the same order as they appear in input?

Can I take the names as command line arguments?

Java (OpenJDK 8), 238 222 221 220 212 bytes
l->{for(String n:l){int k=0,j=0,q=0;for(String b=n.split(" ")[1];k<l.length;j+=l[k++].matches(b+" .*")?1:0)q+=l[k].endsWith(" "+b)?1:0;if(j>0)System.out.println(n+(j>q?" definitely":"")+" has two first names");}}

Try it online!

Nice! You can collapse your initializations to k=j=q=0. Also, it won't save you any bytes but you could replace the latter x+=y?1:0 with if(y)x++. If you like to optimize readability after length like I do, that's probably the way to go.

You can save 8 bytes by putting the String and int directly (in the for-loop): l->{for(String n:l){int k=0,j=0,q=0;for(String b=n.split(" ")[1];k<l.length;j+=l[k++].matches(b+" .*")?1:0)q+=l[k].endsWith(" "+b)?1:0;if(j>0)System.out.println(n+(j>q?" definitely":"")+" has two first names");}}

Python 2, 141 137 132 130 bytes
-2 bytes thanks to @JonathanFrech
n=map(str.split,input())
for f,l in n:
 c=cmp(*[x.count(l)for x in zip(*n)])
 if~c:print f,l,'definitely '*c+'has two first names'

Try it online!

I think -c<1 can be ~c, as c does not appear to ever get positive.

Perl 5, 120 118 + 2 (-al) = 120 bytes
$f{$F[0]}++;$l{$k{$_}=$F[1]}++}{map{print$_.' definitely'x($f{$t}>$l{$t})." has two first names"if$f{$t=$k{$_}}}keys%k

Try it online!

AWK, 127 123 bytes
{a[$1]++
b[L[++X]=$2]++
N[X]=$0}END{for(;++i<=X;)if(A=a[L[i]])print N[i],(b[L[i]]<A?"definitely ":"")"has two first names"}

Saving 1 byte by not using the built-in NR value.
Try it online!

Ruby, 105 129 bytes
+24 bytes because I missed part of the spec
->a{a.map{|e|l=e[r=/\S+$/];i=a.count{|n|n[/\S+/]==l};e+"#{' definitely'if i>a.count{|n|n[r]==l}} has two first names"if i>0}-[p]}

Try it online!

Python 2, 140 127 122 131 bytes
N=map(str.split,input())
F,L=zip(*N)
for f,l in N:
 if l in F:print f,l,'definitely '*(F.count(l)>L.count(l))+'has two first names'

Try it online!

05AB1E, 144 bytes (Work in progress)
|vy#Dθˆн})©gF®®NèQO¯®NèQO-D®¯NèQO¯¯NèQO-D.À>0›s>0›&i0›s0›&i®Nè" "¯Nè" defínítely has two fírst names"J,ë®Nè" "¯Nè" has two fírst names"J,}ë\\}}´

No it works, I am just working on reducing the number of bytes

05AB1E, 53 51 bytes
|UXv“€°‚•€ÛŒî“D„´Î ì)yð«ìõ¸ìXð¡øεy#θQO}`.S>sèˆ}¯õK»

Try it online!
Explanation
|                                                       # Take inputs as array
 UX                                                     # Store in X and push X to stack
   v                                          }         # For each name, do
    “€°‚•€ÛŒî“D                                         #   Push "has two first names" twice
               „´Î ì                                    #   Prepend "definitely " to one of those
                    )yð«ì                               #   Wrap both strings in an array and prepend (name + " ") to each
                         õ¸ì                            #   Prepend " " to array
                            Xð¡øεy#θQO}`                #   Get occurences in input first and last names
                                        .S>             #   0 for not first name, 1 for first name and 2 for definitely first name
                                           sèˆ          #   Get string at that index and push to global array
                                               ¯õK»     # Output global array, 1 string per line

Or 51 49 bytes, assuming standard I/O Rules (input and output as arrays)
UXv“€°‚•€ÛŒî“D„´Î ì)yð«ìõ¸ìXð¡øεy#θQO}`.S>sèˆ}¯õK

Try it online!

PHP, 172 bytes
for(;$s=$argv[++$i];$f[$a]++,$l[$n[]=$b]++)[$a,$b]=explode(" ",$s);for(;$b=$n[+$k++];)$f[$b]<$l[$b]||print$argv[$k].($f[$b]>$l[$b]?" definetly":"")." has two first names
";

takes names as separate command line arguments.
Run with -nr or try it online.

Python 3, 187 bytes
n={}
c=[]
while 1:
 try:a,b=input().split();n[a]=n.get(a,0)+1;n[b]=n.get(b,0)-1;c+=[[a,b]]
 except:[print(a,b,'definitely has two first names'[(n[b]>0)*11:])for a,b in c if n[b]>=0];break

R, 207 bytes
n=readLines("stdin")
s='definitively has two first names\n'
x=matrix(t(unlist(sapply(n,strsplit,' '))),2)
j=1
for(i in n){a=apply(x[2,j]==x,1,sum)
b=a[2]>=a[1]
if(a[1])cat(paste(i,substr(s,14*b,34)))
j=j+1}

Try it online!

JavaScript (ES6), 149 bytes
s=>s.replace(/(.*) (.*)\n/g,(_,t,u)=>g(`
${u} `)>1?t+` ${u}${v>g(` ${u}
`)?` definitely`:``} has two first names
`:``,g=u=>v=`
${s}`.split(u).length)

I/O includes trailing newline. Largely inspired by @RobertoGraham's answer.

Haskell, 144 140 139 bytes
g.map words.lines
g s=id=<<[n++' ':f++[c|c<-" definitely",t 0>t 1]++" has two first names\n"|[n,f]<-s,let t i=filter(==f)$map(!!i)s,[]<t 0]

Try it online!

PowerShell, 176 bytes
$n=$args
$s=" has two first names"
$f=$n|%{$_.Split()[0]}
$l=$n|%{$_.Split()[1]}
$i=0
$l|%{switch(($f-match$_).count){{$_-eq1}{$n[$i]+$s}{$_-gt1}{$n[$i]+" definitely"+$s}}$i++}


text:
Generate random LTL Formulae
An LTL Formula l is defined by the following grammar (where <x> describes the non-terminal symbol x):
<l> ::= <b> | F <l> | G <l> | X <l> | (<l> U <l>) | (<l> W <l>) | (<l> R <l>)
            | (<l> & <l>) | (<l> \| <l>) | !<l>
<b> ::= BVar | True | False | (<i> < <i>) | (<i> <= <i>) | (<i> > <i>) | (<i> >= <i>)
             | (<i> = <i>) | (<i> != <i>)
<i> ::= IVar | -128 | -127 | ... | 127 | (<i> + <i>) | (<i> - <i>)
             | (<i> * <i>) | (<i> / <i>)

(I escaped a pipe to denote boolean or. You should not print that backslash in your output)
BVar and IVar represent variables of boolean and integral types respectively. Each must be one of four possible single character variable names, and there may by no overlap between BVar and IVar. For instance, you may choose a,b,c,d for BVar and w,x,y,z for IVar
Note that all binary operators must have parentheses around them and that no other parentheses are allowed.
Your task is to write a function that takes one input encoding the maximal nesting depth of an LTL formula and prints a random formula limited by that depth (but not necessarily exactly that depth). The distribution does not have to be uniformly random, but each possible formula has to have a non-zero chance of being generated.
You may use ≤, ≥, and ≠ instead of <=, >=, and !=.
You may add or remove whitespace as you see fit. Even no whitespace at all is allowed.
Examples:
f(0) -> True
f(0) -> d
f(1) -> (a&b)
f(1) -> Fd
f(1) -> (x<y)
f(3) -> (G(x!=y)|Fb)
f(3) -> (x<(w+(y+z)))

Standard loopholes are forbidden.
This is code-golf, so the shortest code in bytes wins.

May we use ≤, ≥, and ≠ instead of <=, >=, and !=?

That is allowed. I will update the challenge accordingly.

What is the "nesting depth"?

Is everything in <i> evenly divided in terms of randomness? So these four (<i> + <i>) | (<i> - <i>) | (<i> * <i>) | (<i> / <i>) each have a chance of 1/260 to occur (and -128 through 127 also each has a 1/260 chance to occur)?

@PeterTaylor I think (not sure) this refers to the maximum depth of <i>.

Hmm, I guess this also means that if the input is 0, the integer -128 through 127 have a 1/256 change of occurring for <i>; if the input is 1 it at first has first a 1/260 chance of occurring, and if it happens to be +-*/ (4/260 chance), the next time it randomly selects <i> it has a 1/256 chance again because we have reached our maximum nested depth. Am I understanding what you've meant with maximal nested depth correctly, @Sacchan?

@KevinCruijssen The probabilities do not have to be equal. As I stated, every part just has to have a non-zero probability of occurring.
Nesting depth refers to the longest path in the syntax tree of the formula. If you have a depth of zero, you can only have a node without children (such as a constant or a variable). A nesting depth of 1 gives a unary or binary operator with the children having a nesting depth of at most 0. And so forth.

<l> cannot derive 55, as far as I can see. And the path in the syntax tree for True has length 2: <l> -> <b> -> True

It seems (from the examples) that we should read "maximal nesting depth of an LTL formula" liteally (i.e. it is the nesting depth of the resulting formula rather than that of the syntax tree path taken, as assumed by @rici above). Could you clarify this?

Also, if I am correct, could you clarify whether the nesting depth of Fd would be zero or one?

@rici: You are correct, 55 was an erroneous example. I have removed it.

@Jonathan Allan: You are correct. Fd would be a nesting depth of one (since the Tree would have F as root node and d as its child)

Perl 5, 251 bytes
249 bytes code + 2 for -pa.
$d=I;sub a{map"($d$_$d)",@_}@I=(w..z,-128..127,a qw{+ - * /});@L=(@B=(a..d,True,False,a qw{< <= > >= = !=}),B,FL,GL,XL,"!".($d=L),a qw{U W R & |});$_=$L[rand@L];0while s/L|B|I/@{$&}[rand@{$&}]/e;$;=$_;s/[^()]//g;0while s/\)\(//g;$_=y/(//>"@F"?redo:$

Try it online!

Python 3, 298 293 283 279 bytes
def f(n,t=1):s,*X=c([[(c(V[t>1]),)],[('%s',0),(c('FGX!')+'%s',1)]][t&1]+[(f"(%s{c('<U+≤W->R*≥&/=|+≠'[t::3])}%s)",*[2-(t&1)]*2)]);return n and s%tuple(f(n-1,x)for x in X)or c(V[t>1])
from random import*
c=choice
V=['True','False',*'abcd'],[*map(str,range(-128,128)),*'wxyz']

Try it online!

Generated "(XF((dW-91)U(46|21))&c)" for me, and (46|21) is not a valid subformula, same for (dW-91). You use integers where you have to have bools

@Sacchan Ah, I returned either a bool or int when the level was 0.

Java 8, 456 423 419 407 403 bytes
n->{int r=R(9);return r>4?(r<8?"FGX!".charAt(r-5):"")+b(n):"("+b(n)+"UWR&|".charAt(r)+b(n)+")";};int R(int i){return i*=Math.random();}String b(int n){int r=R(9);return r>7?"abcd".charAt(r%4)+"":r>6?"True":r>5?"False":n>0?"("+i(n)+"<≤>≥=≠".charAt(r)+i(n)+")":b(n);}String i(int n){int r=R(n>0?256:261);return(r-=128)>131?"wxyz".charAt(r+2&3)+"":r>127?"("+i(--n)+"+-*/".charAt(r-128)+i(n)+")":r+"";}

-8 bytes thanks to @ceilingcat.
Try it online.
NOTE: Due to the rule "The distribution does not have to be uniformly random", I've been able to golf some parts by using modulo-4 on the input or random integer for the characters "abcd" or "wxyz", and change Math.random()*10 to Math.random()*9 and change the ternary a bit. Personally I prefer to have the randomness equally divided for each method, which is 456 441 404 bytes instead (and is explained below):
n->{int r=R(10);return r>4?(r<9?"FGX!".charAt(r-5):"")+b(n):"("+b(n)+"UWR&|".charAt(r)+b(n)+")";}int R(int i){return i*=Math.random();}String b(int n){int r=R(9);return r>7?"abcd".charAt(R(4))+"":r>6?"True":r>5?"False":n>0?"("+i(n)+"<≤>≥=≠".charAt(r)+i(n)+")":b(n);}String i(int n){int r=R(n>0?256:261);return(r-=128)>131?"wxyz".charAt(R(4))+"":r>127?"("+i(--n)+"+-*/".charAt(r-128)+i(n)+")":r+"";}

Try it online.
Explanation:
n->{                     // Method with integer parameter and String return-type
  int r=R(10);           //  Random integer [0,9]
  return r>4?            //  Is it [5,9]:
    (r<9?                //   Is it [5,8]:
      "FGX!".charAt(r-5) //    Return a leading character
     :                   //   Else (it's 9):
      "")                //    Return nothing
    +b(n)                //   + call to method `b(n)`
   :                     //  Else (it's [0-4]):
    "("                  //   Return opening parenthesis
    +b(n)                //   + call to method `b(n)`
    +"UWR&|".charAt(r)   //   + middle character
    +b(n)                //   + another call to method `b(n)`
    +")";                //   + closing parenthesis
}                        // End of method

int R(int i){            // Method `R(i)` with integer as both parameter and return-type
  return i*=Math.random();
                         //  Return a random integer in the range [0,i)
}                        // Else of method `R(i)`

String b(int n){         // Method `b(n)` with integer parameter and String return-type
  int r=R(9);            //  Random integer [0,8]
  return r>7?            //  Is it 8:
     "abcd".charAt(R(4))+""
                         //   Return random from "abcd"
   :r>6?                 //  Else-if it's 7:
    "True"               //   Return literal "True"
   :r>5?                 //  Else-if it's 6:
    "False"              //   Return literal "False"
   :n>0?                 //  Else-if it's [0-5] AND the input is larger than 0:
    "("                  //   Return opening parenthesis
    +i(n)                //   + call to method `i(n)`
    +"<≤>≥=≠".charAt(r)  //   + middle character
    +i(n)                //   + another call to method `i(n)`
    +")"                 //   + closing parenthesis
   :                     //  Else (it's [0-5] and the input is 0):
    b(n);                //   Call itself again, hoping for random [6-8]
}                        // End of method `b(n)`

String i(int n){         // Method `i(n)` with integer parameter and String return-type
  int r=R(n>0?256:261);return(r-=128)
                         //  Random integer in range [-128,128]
                         //  OR [-128,132] if the input is larger than 0
  >131?                  //  If it is 132:
     "wxyz".charAt(R(4))+""
                         //   Return random from "wxyz"
   :r>127?               //  Else-if it's [128,131]:
    "("                  //   Return opening parenthesis
    +i(--n)              //   + call to `i(n-1)`
    +"+-*/".charAt(r-128)//   + middle character
    +i(n)                //   + another call to `i(n-1)`
    +")"                 //   + closing parenthesis
   :                     //  Else:
    r+"";                //   Return the random integer [-128,127]
}                        // End of method `i(n)`

source: Stack Exchange

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

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

sort: votes


text:
Draw the lambda blazon
To celebrate the 2497th anniversary of the Greek victory at Salamis in 480 BC. Draw the lambda blazon.
The lambda blazon was the lambda painted on greek shields like so:

Puzzle: Given a positive odd integer n, produce an ascii art image of the above shield.
Specifications:
n=1:
( /\ )

n=3:
(   /\   )
|  /  \  |
( /    \ )

n=5
(     /\     )
|    /  \    |
|   /    \   |
|  /      \  |
( /        \ )

Graph:
n=3
          2|   (   /\   )
y-axis    1|   |  /  \  |
          0|   ( /    \ )
               ___________
               0123456789

                 x-axis

Description:
There should be exactly n \ characters and n / characters. The /s and \s should not touch the edge of the shield. The bottom and top corners of the shield will be denoted with a ( or ) unless n=1 where there will be one ) and one (. There will always be one space between the bottom corners and the lambda, increasing by 1 with the y axis until y + 1 == n. Non corners of the shield side will be denoted with |. There is no shield top.

can you add the output for n=5 or n=7

@Rod added n=5 for you

Why downvote? (2 more to go)

@user202729 im confused what you mean.

I'm asking the downvoters, not you. Sorry if it is unclear.

@user202729 what do you mean 2 more to go?

SE has comment character restriction, which force comments to be at least 15 characters.

Why couldn't you have waited 3 years to post it for the 2.5k'th anniversary ;-;

@HyperNeutrino I literally googled "today in history" and found that to make a golf out of :)

Would these shields have been used in a naval battle?

Its very possible, much of the combat was spear throwing and many used these type of shields in conjunction with their spears.

That's what I get for playing Age of Empires... they just launched their giant projectiles at each other

Why only odd integers? :o

Charcoal,  17  13 bytes
Thanks to @Neil for saving 4 bytes!
(↙↓⊖θＭ↑(→↗Ｎ‖Ｍ

Try it online!
Explanation:
(↙                // Print '(' and move one step down and to the left.
  ↓⊖θ             // Print n-1 '|'s downwards.
     Ｍ↑          // Move one step up.
        (→        // Print '(' and move one step to the right.
          ↗Ｎ      // Print n '/'s towards the upper right corner.
            ‖Ｍ    // Mirror the left half to produce the right half.

⊖ saves you a byte, and half of your Ｍs are unnecessary.

Also, your Ｉθ can be Ｎ to save another byte.

Summing up Neil's suggestions, 13 bytes

@Mr.Xcoder Thanks, but I got around to doing those already.

It's small, but I believe in your explanation (→ should mean "... and move one step to the right"

SOGL V0.12, 17 14 bytes
┐*ƨ(Κm«@.╚┼┼╬³

Try it Here!
Explanation:
example input: 3
┐*              push a string of input amount of "|"                      "|||"
  ƨ(            push "("                                                  "|||", "(("
    Κ           prepend that to the vertical bar string                   "((|||"
     m          mold that string as the input (remove excess characters)  "((|"
      «         put the first character at the end                        "(|("
       @        push a space                                              "(|(", " "
        .╚      create a diagonal of input length                         "(|(", " ", ["  /", " / ", "/  "]
          ┼┼    append those three horizontally together                  ["(   /", "|  / ", "( /  "]
            ╬³  palindromize that all

C (gcc), 103 96 bytes

Saved seven bytes thanks to ceilingcat.

f(n,j,b){for(j=n;j--;printf("%c%*c%*c%*c\n","|("[b],j+2,47,n+n-j+~j,92,j+2,"|)"[b=j<1|n-2<j]));}

Try it online!

We excuse the main and includes now? This community has changed.

@AlecTeal It is acceptable to write a function that performs the specified task rather than a full program. Includes in general do count towards the byte count, some C compilers, however, attempt to guess a function definition if no matching includes are present.

Think you crossed out the wrong number, chief

@Veskah True. ._.

Retina, 41 bytes
.+
$*

( $'/$`$`\$' )¶
G`.
sT`()`|`¶.*¶

Try it online! Explanation:
.+
$*

Convert to unary, but using spaces.

( $'/$`$`\$' )¶

Use the match prefix and suffix operators to generate a series of lines with increasing amounts of centre space on each line.
G`.

However, there's an extra blank line, which throws off the final transliteration, so delete it here.
sT`()`|`¶.*¶

On all lines except the first and last, change the ()s to |s.

Perl 5, 91 + 1 (-p) = 92 bytes
$_='('.($s=$"x($q=$_))."/\\$s)";while(--$q){say;y/()/|/;s| /|/ |;s|\\ | \\|}s/\|/(/;s/\|/)/

Try it online!

Java (OpenJDK 8), 200 190 170 bytes
n->{for(char i=0,s[];i<n;s[-~n-i]=47,s[2+n+i]=92,s[0]=i<1|i>n-2?40:'|',s[3+n+n]=i<1|i++>n-2?41:'|',System.out.println("".valueOf(s).replace('\0',' ')))s=new char[4+n+n];}

Try it online!

167 bytes

Pyth, 43 bytes
This is quite gigantic given that it's been done on mobile :-/
j_m++++++@"(|"J!/,1QdK*;d\/*;y-Qd\\K@")|"JS

Try it online!

Python 2, 85 bytes
n=a=input()
while a:print'(|'[1<a<n]+a*' '+'/'+(n-a)*'  '+'\\'+a*' '+')|'[1<a<n];a-=1

Try it online!

R, 153 bytes
function(n){s=2*n+4
m=matrix('|',s,n)
m[3:s-1,]=' '
m[cbind(5:s-2,c(n:1,1:n))]=1
m[1,c(1,n)]='('
m[s,c(1,n)]=')'
m[m>0]=rep(c('/','\\'),n)
rbind(m,'\n')}

Try it online!

Batch, 218 bytes
@echo off
set s=
for /l %%i in (1,1,%1)do call set s= %%s%%
set s=%s%/\%s%
echo (%s%)
for /l %%i in (2,1,%1)do call:l %1 %%i
exit/b
:l
set s=%s: /=/ %
set s=%s:\ = \%
if %1==%2 (echo ^(%s%^))else echo ^|%s%^|

As if |s weren't bad enough, ()s don't work well with if...else.

05ab1e (27 bytes)
F"|("0NQ¹<NQ~èð¹N-×'/ðN×J∞,

try it online
explanation
F                                                #Loop n times
 |("0NQ¹<NQ~è                                    #Use ( or |
             ð¹N-×                               #put spaces (1)
                  '/                             #put /
                    ðN×                          #put more space
                       J∞,                       #reverse image

I think '/¹N-ú is a byte shorter than ð¹N-×'/.

Nice approach, but there are a few things to golf. One is what @Neil suggested above. In addition: "|(" can be „|( (there are builtins for 1, 2, and 3-char strings being ', „ and … respectively); and 0NQ¹<NQ~ can be Î‚Nåè (Î seems to be bugged in the legacy version of TIO, but it does work in the latest version of 05AB1E, in which case you'll also have to replace ∞ with º). So in total (21 bytes): F„|(Î‚Nåè'/¹N-úðN×Jº, Try it online.

Funky, 101 bytes
n=>for(i=0;i<n;i++)print(((c=(i==n-1)or!i)?"(":"|")..(s=" "*n-i).."/"..(" "*i*2).."\\"..s..c?")":"|")

Try it online!

Python 2, 90 bytes
n=input()
for i in range(n):m=-~i%n<2;s=' '*(n-i);print'|('[m]+s+'/'+'  '*i+'\\'+s+'|)'[m]

Try it online!
-1 thanks to ovs.

fails for n=1, but can be fixed by replacing i%~-n<1 with -~i%n<2

@Rod thanks, fixed

90 bytes: '<space>'*i*2 -> '<space><space>'*i

@ovs @_@ why didn't I think of that

Python 3, 110 bytes 93 bytes
b=c=int(input())*2
d,e='/\\'
while b:print('(|%%ss)|'[2<b<c::2]%f' {d+e:^{c}} ');d+='  ';b-=2

C# (.NET Core), 188 bytes
n=>{int y=0,i=-1;var s="";while(y<n){var r=new char[n*2+4];r[n+1-y]='/';r[n+2+y]='\\';if(y<2|y++>n-2)i++;r[0]="(|("[i];r[n*2+3]=")|)"[i];s+=new string(r)+"\n";}return s.Replace("\0"," ");}

Try it online!
Degolfed
n=>{
    int y=0,i=-1;
    var s="";

    while(y<n){
        var r=new char[n*2+4];
        r[n+1-y]='/';
        r[n+2+y]='\\';

        if(y<2 | y++>n-2)
            i++;

        r[0] = "(|("[i];
        r[n*2+3] = ")|)"[i];

        s += new string(r)+"\n";
    }

    return s.Replace("\0"," ");
}

185 bytes

PowerShell,  93 91 90 89 bytes
-2 Thanks to ASCII-only for pointing out extra parens
-1 Thanks to Mazzy for tweaking swap logic
param($n)0..--$n|%{"|("[!($x=($n-$_)*$_)]+($y=" "*($n-$_+1))+"/"+"  "*$_+"\$y"+"|)"[!$x]}

Try it online!
Trying to tweak that $x= bit. There's probably a smarter way to get the 1st and last line out in a few less bytes. There is a better $x= but it isn't much cheaper.

89 bytes: Try it online!

Canvas, 12 bytes
┤|×(ｅ⟳ ＋╴／＋║

Try it here!
Explanation:
┤             decrease the input by 2
 |×           repeat "|" vertically - if the amount is -1 (for input of 1), ir just removes the item currently
   (          push "("
    ｅ        encase in that parentheis - if that first string isn't there, currently it just fails doing anything and leaves the parenthesis on the stack
     ⟳       rotate clockwise
       ＋     append horizontally a space
        ╴／   get a diagonal the length of the input
          ＋  append it horizontally to the current result
           ║  and palindromize horizontally with 0 overlap

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


text:
Change the rules of Life
Life-like cellular automaton are cellular automaton that are similar to Conway's Game of Life, in that they operate on a (theoretically) infinitely large square grid, where each cell has exactly 8 neighbours, and is one of 2 states, namely alive and dead.
However, these Like-like versions are different in a crucial way: the rules for a given cell to come alive and the rules for a given cell to survive to the next generation.
For example, classic Game of Life uses the rule B3/S23, meaning that it takes 3 alive cells to birth a new one, and either 2 or 3 living neighbours to survive. For this challenge, we will assume that neighbours do not include itself, so each cell has exactly 8 neighbours.
Your task is, given a starting configuration, a birth rule, a survival rule and a positive integer (the number of generations to be run), simulate the Life-like automaton using those rules for the number of generations given in the shortest code possible. The starting configuration will be a square matrix/2-dimensional array or a multiline string, you may choose. The others may be given in any reasonable format and method.
For example, if the birth rule was 12345678 (any living neighbours), the survival rule was 2357 and the starting configuration was
0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0

the next two generations would be
Generation 1:           Generation 2:

0 0 0 0 0               1 1 1 1 1
0 1 1 1 0               1 1 0 1 1
0 1 0 1 0               1 0 1 0 1
0 1 1 1 0               1 1 0 1 1
0 0 0 0 0               1 1 1 1 1

If the number of generations given was 10, the output would be something along the lines of
0 1 1 1 0
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
0 1 1 1 0

You do not have to handle changes that happen outside of the bounds given by the input matrix, however, all cells outside the matrix begin dead. Therefore, the input matrix may be any size, up to the maximum value your language can support. You do not have to output the board between generations.
This is a code-golf so the shortest code wins.
Test cases
These use the B/S notation to indicate the rules used
B2/S2, generations = 100, configuration:
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0

Output:
0 0 0 0 0 0 0 0
0 1 0 0 0 0 1 0
1 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

B1357/S2468, generations = 12, configuration:
1 0 1 0 1 0
0 1 1 0 1 0
1 0 0 0 0 0
0 0 0 0 0 1
1 1 1 1 1 0
0 1 1 0 0 1

Output:
0 1 0 0 0 0
0 1 1 1 1 0
0 1 0 1 1 0
1 1 1 0 0 0
0 0 1 1 1 0
0 1 1 0 0 0

If you need to generate more test cases, you can use this wonderful simulator. Please make sure to limit the board size

Is the simulation toroidal?

@EriktheOutgolfer no, as the matrix is (theoretically) infinite in size

Also, can we assume the given matrix is square?

@EriktheOutgolfer "infinitely large square grid"

But it doesn't say you can assume that...will edit in.

How will the input be given? Can we assume the starting configuration is given in the form of the 2D array/multiline string/etc? And can the birth and survival rules be given as lists/arrays of integers, or must we take them as a string as shown?

@ArnoldPalmer you may take input in standard methods, "The starting configuration will be a square matrix/2-dimensional array or a multiline string, you may choose." and you can take them in any reasonable format

MATL, 24 23 bytes
xx:"tt3Y6Z+1Gm<8M2Gmb*+

Inputs are:

Array with birth rule
Array with survival rule
Number of generations
Matrix with initial cell configuration, using ; as row separator.

Try it online! Or see test cases: 1, 2.
For a few bytes more you can see the evolution in ASCII art.
Explanation
xx      % Take two inputs implicitly: birth and survival rules. Delete them
        % (but they get copied into clipboard G)
:"      % Take third input implicitly: number of generations. Loop that many times
  tt    %   Duplicate twice. This implicitly takes the initial cell configuration
        %   as input the first time. In subsequent iterations it uses the cell
        %   configuration from the previous iteration
  3Y6   %   Push Moore neighbourhood: [1 1 1; 1 0 1; 1 1 1]
  Z+    %   2D convolution, maintaining size
  1G    %   Push first input from clipboard G: birth rule
  m     %   Ismember: gives true for cells that fulfill the birth rule
  <     %   Less than (element-wise): a cell is born if it fulfills the birth rule
        %   *and* was dead
  8M    %   Push result of convolution again, from clipboard M
  2G    %   Push second input from clipboard G: survival rule
  m     %   Ismember: gives true for cells that fulfill the survival rule
  b     %   Bubble up the starting cell configuration
  *     %   Multiply (element-wise): a cell survives if it fulfills the survival
        %   rule *and* was alive
  +     %   Add: a cell is alive if it has been born or has survived, and those
        %   are exclusive cases. This produces the new cell configuration
        % Implicit end loop. Implicit display

Can you save bytes by changing the order of the inputs? The xx at the start seems a bit wasteful to me...

@EriktheOutgolfer I don't see how. I need to delete the first two to later reuse them several times (one per iteration), and the other inputs are already implicit now

Oh so "deleting" the inputs adds them to some sort of input list?

@EriktheOutgolfer Yes. MATL input is interactive, meaning the program doesn't know in advance how many input there are. Here, deleting from an empty stack causes an input to be implicitly taken. Once taken, each input gets copied into clipboard G, and they can be retrieved later.

Wolfram Language (Mathematica), 144 122 bytes
CellularAutomaton[{Tr[2^#&/@Flatten@MapIndexed[2#+2-#2[[1]]&,{#2,#3},{2}]],{2,{{2,2,2},{2,1,2},{2,2,2}}},{1,1}},#,{{#4}}]&

Try it online!
Example usage:
%[RandomInteger[1, {10, 10}], {2, 3}, {3}, 5]

uses a 10x10 random grid as a start, survives with either 2 or 3 neighbors, births with 3 neighbors, plot result at 5 iterations.

Too bad the builtin is only one dimensional (correct me if I'm wrong)

I’m using the built-in “CellularAutomaton” with a 9-neighbor totalistic rule.  Much of the code converts the survival/birth inputs into a rule number.

R, 256 bytes
function(x,B,S,r){y=cbind(0,rbind(0,x,0),0)
n=dim(y)[1]
z=c(1,n)
f=function(h){w=-1:1
b=h%%n+1
a=(h-b+1)/n+1
'if'(a%in%z|b%in%z,0,sum(x[w+b,w+a])-x[b,a])}
while(r){x=y
for(i in 1:n^2){u=f(i-1)
y[i]=u%in%B
y[i]=(y[i]&!x[i])|(x[i]&(u%in%S))}
r=r-1}
y[-z,-z]}

Try it online!
Sadly, this does not look as golfed as I'd hoped.
Input: an R matrix, and the challenge parameters. Output: the matrix after R generations.
The algorithm pads the matrix with zeros to handle the boundaries. Then, iteratively: 1st) it applies the Birth rule and 2nd) it kills the pre-existing cells that did not pass the Survival rule. Padding is removed when returning.

nice byte count!

I managed to get it to 217 bytes but if we can find exactly one more golf, we can get it to 216 which is at least a cube...

Python 2, 156 149 146 bytes
lambda R,g,c:g and f(R,g-1,[[`sum(sum(l[y+y/~y:y+2])for l in c[x+x/~x:x+2])-c[x][y]`in R[c[x][y]]for y,_ in e(c)]for x,_ in e(c)])or c
e=enumerate

Try it online!
Takes input:

Rules: [birth,survial] rules as list of string. eg.(['135','246'])
generations: int
configuration: Square 2D array of 1/0 or True/False

Returns 2d array of True/False

APL (Dyalog Unicode), 38 36 34 bytes (SBCS)

Saved 2 4 bytes thanks to @ovs!

{(((1⊥,)∊⍺(⍵+1)⊃⍨4⊃,)⍤⊢⌺3 3⍣⍵⍵)⍺⍺}

Try it online!
Can be invoked with birth_rule (start_grid f epochs) survival_rule, where f is the operator. Requires 0-indexing.
For some reason, using the trains (+/,) and (4⊃,) to make it 36 bytes doesn't work. As ovs explained, it's because ⌺ calls functions dyadically. Anyway, their new solution is 34 bytes.

⍣ can repeatedly apply a function some number of times, given a starting value. In this case, the starting value is the left operand, and the right operand tells it how many times to repeat.
((1⊥,)∊⍺(⍵+1)⊃⍨4⊃,)⍤⊢⌺3 3 computes the next generation. The stencil operator (⌺) creates windows of a given shape (a 3x3 square here), applies a function on each of them, and puts them back together into a matrix. For cells on the edge of the grid, it will use zeroes, which works well with this challenge.
The train ((1⊥,)∊⍺(⍵+1)⊃⍨4⊃,)⍤⊢ is applied to each of those windows. ⍤⊢ applies the stuff before it to the second argument. 1⊥, calculates the number of neighbors (including the cell) by turning the 2D window into a vector (,) and then summing it (1⊥). ∊ checks if that the number of neighbors is in either the birth rule or survival rule vector. Whether the birth rule or survival rule is chosen depends on the train ⍺(⍵+1)⊃⍨4⊃,.
4⊃, turns the window into a vector and chooses the 5th cell, which is the cell we are calculating the next generation of. ⍺(⍵+1) is an array where the first element is the birth rule and the second element is the survival rule, but with its elements increased by one (because we're including the current cell). Then ⊃⍨ uses the current cell/5th cell/middle cell to index into this array, so if the cell's dead (0) the birth rule will be used, and if the cell is alive (1) the survival rule will be used.

The trains don't work because ⌺ gives a left argument to the function, which means all function in there are called dyadically. (+/∘,⊢) and (4⊃∘,⊢) would work, but are too long. You can save two bytes by removing the brackets around ⍺(⍵+1)⊃⍨{4⊃,⍵}.

@ovs Ah, thanks, that makes sense now. Also thanks for the brackets, I should have realized they were unnecessary.

f←{(((+/,)∊⍺(⍵+1)⊃⍨(4⊃,))⍤⊢⌺3 3⍣⍵⍵)⍺⍺} works in version 18, but is the same length as your current function.

My suggestion had redundant brackets again, 34 bytes ;)

@ovs Thanks! That's 4 bytes saved now!


text:
Binary Prime-Chunks
We are searching for a sequence
Take the natural numbers
1,2,3,4,5,6,7,8,9,10,11,12,13,14...
Convert to base-2
1,10,11,100,101,110,111,1000,1001,1010,1011,1100,1101,1110...
Concatenate the above numbers
110111001011101111000100110101011110011011110...
Partition this number in Prime-Chunks
(chunks containing a prime number of digits)
Primes are taken in asceding  order 2,3,5,7,11,13,17...
[11][011][10010][1110111][10001001101][0101111001101][1110...]
and find the Sum of the digits of each chunk
Primes        2   3     5       7          11            13        17
Chunks      [11][011][10010][1110111][10001001101][0101111001101][1110...]
SumOfDigits   2   2     2       6          5             8
The Sequence

2, 2, 2, 6, 5, 8, 9, 10, 14, 22, 11, 18, 25, 27, 32, 21, 28, 32, 40, 40, 49, 49, 32, 41, 49, 53, 63, 55, 63, 70, 87, 73, 51, 63, 71, 78, 78, 90, 107, 86, 96, 108, 115, 128, 138, 92, 83, 95, 102, 110, 130, 106, 122, 141, 149, 163, 130, 140, 151, 165, 181, 165, 204, 200, 234, 100, 130, 138, 167, 149, 169, 180, 209, 166, 189, 194, 222, 205, 234, 260, 216, 206, 217, 241, 240, 267, 289, 242, 274, 308, 286, 329, 338, 155, 189, 225, 197, 240, 272, 217, 254, 282, 287, 317, 281, 256, 299, 286, 331, 337, 316, 350, 354, 391, 367, 282, 327, 313, 364, 358, 348, 397, 406, 466...

The Challenge
Find the nth term of the above sequence
Input
An integer n>0
Test Cases
1->2
3->2
6->8
36->78
60->165
160->581
260->1099
350->1345

This is codegolf.Shortest answer in bytes wins!

Related (first three steps are the same)

Downvoted because this feels too much like a bunch of challenges mashed together.

Husk, 8 bytes
Σ!CİpṁḋN

Try it online!
Explanation
Σ!CİpṁḋN
       N   Start with the infinite list of natural numbers.
     ṁḋ    Convert each to its binary representation and join them all together. (A)
   İp      Get the infinite list of primes. (B)
  C        Split (A) into chunks of lengths (B).
 !         Retrieve the nth chunk (where n is the input).
Σ          Sum the bits in this chunk.

Jelly, 12 bytes
RÆNµSRBFṁRṪS

Try it online!
How it works
RÆNµSRBFṁRṪS  Main link. Argument: n

R             Range; yield [1, ..., n].
 ÆN           N-th prime; yield P := [p(1), ..., p(n)].
   µ          Begin a new, monadic chain with argument P.
    S         Take the sum of P, yielding s := p(1) + ... + p(n).
     R        Range; yield [1, ..., s].
      B       Binary; convert all integers from 1 to s to base 2.
       F      Flatten the resulting array.
         R    Range; yield [[1, ..., p(1)], ..., [1, ..., p(n)]].
        ṁ     Mold; reshape the result to the left like the result to the right.
          Ṫ   Tail; take the last chunk.
           S  Take the sum, counting the set digits.

05AB1E, 12 bytes
Code
Can get pretty slow for large numbers:
ÅpDOLbJs£`SO

Uses the 05AB1E-encoding. Try it online!
Explanation
Åp              # Get a list of the first <input> primes
  DO            # Duplicate and sum the primes
    L           # Create the list [1, .., <sum>]
     bJ         # Convert to binary and join into a single string
       s£       # Get the slices [a[0:2], a[2:2+3], a[2+3:2+3+5], a[2+3+5:2+3+5+7], ...]
                  corresponding to the list of primes
         `SO    # Get the last one and sum up it's digits

Mathematica, 71 bytes
(Tr/@TakeList[Join@@IntegerDigits[Range[#^2+1],2],Prime~Array~#])[[#]]&

Try it online!

Jelly, 21 bytes
RÆNSRBF
RÆN+\‘ṬœṗÇ⁸ịS

Try it online!

R, 206 200 bytes
function(n){a=p=j=y=2
for(i in 2:n-1){while(sum(y)<4*a){x=as.double(rev(intToBits(j)))
y=c(y,x[cumsum(x)>0])
j=j+1}
b=1:a
y=y[-b]
z=outer(k<-b+a,p,'%%')
p=c(a<-k[!apply(z<1,1,sum)][1],p)}
sum(y[1:a])}

Try it online!
The algorithm tries also to "save" on space by iteratively removing bits as it cycles through the primes. I feel that the decimal to bit conversion could probably be shorter, but I could not figure out other alternatives.
Saved 6 bytes thanks to Jonathan French.

I think R supports chained assignment; p=j=2 is two bytes shorter than p=2;j=2.

...which can probably also be done for a=p, saving yet another two bytes.

...and -- I do not know why -- it also seems to work for y=1, replaced with y=2, resulting in 200 bytes.

Thank you. The y=2 replaces the bit for numeral 1. It works because for n>1, it is pruned away at the first iteration, and for n=1, the for loop loops backward, thus providing the answer for n=3, which is still 2 (not that bad of a luck).

Jelly, 16 bytes
RBFṁ
RÆNSÇṫÆNC$S

Try it online!
Explanation
RBFṁ  Helper link. Input: integer k
R     Range, [1, 2, ..., k]
 B    Convert each to a list of its binary digits
  F   Flatten
   ṁ  Shape it to length k

RÆNSÇṫÆNC$S  Main link. Input: integer n
R            Range, [1, 2, ..., n]
 ÆN          Get i'th prime for each
   S         Sum
    Ç        Call helper link
         $   Monadic chain
      ÆN       Get n'th prime
        C      Complement, 1 - n'th prime
     ṫ       Tail, take the last n'th prime digits
          S  Sum

JavaScript (ES6), 144 bytes
n=>eval("s=o=j=0;for(i=p=1;n;d>p&&(n--,s+=p))for(p++,d=2;p%d++;);while(b=Math.log2(++j)+1|0,i<=s)for(x=0;x++<b&i<=s;)o+=i++>s-p&&j<<x&1<<b?1:0")

Ungolfed
n=>{
    s=o=j=0;
    for(i=p=1;n;d>p&&(n--,s+=p))
        for(p++,d=2;p%d++;);
    while(b=Math.log2(++j)+1|0,i<=s)
        for(x=0;x++<b&i<=s;)
            o+=i++>s-p&&j<<x&1<<b?1:0
    return o
}

Test Cases

f=
n=>eval("s=o=j=0;for(i=p=1;n;d>p&&(n--,s+=p))for(p++,d=2;p%d++;);while(b=Math.log2(++j)+1|0,i<=s)for(x=0;x++<b&i<=s;)o+=i++>s-p&&j<<x&1<<b?1:0")

;[1,3,6,36,60,160,260,350].forEach(t=>console.log(t,"->",f(t)))
.as-console-wrapper{max-height:100%!important}

Perl 6, 67 bytes
{(1..*).map(|*.base(2).comb).rotor(grep *.is-prime,2..*)[$_-1].sum}

Test it
Expanded:
{  # bare block lambda with implicit parameter ｢$_｣

  (

    1 .. *                # Range of all numbers starting with 1

  ).map(

    # WhateverCode lambda
    |                     # Slip each of these values into the outer list individually
      *                   # this is the parameter
      .base(2)            # convert base
      .comb               # split into digits

  ).rotor(                # split into chunks

    grep *.is-prime, 2..* # the sequence of prime numbers

  )[ $_ - 1]              # index into it using 1 based indexing

  .sum                    # find the sum
}

JavaScript (ES6), 138 132 123 bytes
N=>(n=k=1,g=s=>N?g((P=n=>n%--x?P(n):x<2)(x=++n)?s[n]?s.slice(--N&&n,n/!N):s+(n--,k++).toString(2):s):s.split`1`.length-1)``

Test cases
Try it online!
Demo
NB: Only 'safe' test cases are included here (guaranteed to work on Chrome, Firefox and Edge). You may have to increase the call stack size of your engine to pass the other ones.

let f =

N=>(n=k=1,g=s=>N?g((P=n=>n%--x?P(n):x<2)(x=++n)?s[n]?s.slice(--N&&n,n/!N):s+(n--,k++).toString(2):s):s.split`1`.length-1)``

console.log(f(1))   // 2
console.log(f(3))   // 2
console.log(f(6))   // 8
console.log(f(36))  // 78
console.log(f(60))  // 165

Formatted and commented
N => (                            // given N = index of the expected term
  n = k = 1,                      // n = current prime, k = current natural number
  g = s =>                        // g = recursive function taking s = binary string
    N ?                           //   if we haven't reached the correct chunk yet:
      g(                          //     do a recursive call to g():
        (P = n =>                 //       P() returns: true for prime
          n % --x ? P(n) : x < 2) //                    false for composite
        (x = ++n) ?               //       increment n; if n is prime:
          s[n] ?                  //         if s is long enough:
            s.slice(--N && n,     //           either remove this chunk (if N > 0)
                    n / !N)       //           or truncate it to the correct size (if N = 0)
          :                       //         else:
            s + (n--, k++)        //           append the next natural number to s
                .toString(2)      //           in binary format
        :                         //       else:
          s                       //         just look for the next prime
      )                           //     end of recursive call
    :                             //   else:
      s.split`1`.length - 1       //     return the number of 1's in the last chunk
)``                               // initial call to g() with an empty string

Python 2, 114 bytes
n=input();k=m=1;p=[0];s=''
exec's+=bin(k)[2:];p+=m%k*[k+p[-1]];m*=k*k;k+=1;'*n*n*2
print s[p[n-1]:p[n]].count('1')

Try it online!

Python 2, 143 139 133 bytes
-4 bytes thanks to @ErikTheOutgolfer
s='1';i=x=1
exec"s=s[i:];i+=1\nwhile~-all(i%x for x in range(2,i)):i+=1\nexec's+=bin(x)[2:];x+=1;'*i;"*input()
print s[:i].count('1')

Try it online!

-2 bytes by removing incompatible test harness. Another -2 by rearranging some stuff.

@EriktheOutgolfer thanks a lot. I was still able to add my old tests back.

J, 48 bytes
([:+/-@{:{.+/{.[:}:[:(#:@[,])/1+[:i.1++/)@:p:@i.

explained
(                                                         )@:p:@i.  the first n primes, passed to...
       -@{: {.                    ...                               take "nth prime" elements from the tail of...
               +/                                                   sum the first n primes and...
                  {.                                                take that number of elements from...
                     [: }:                                          all but the last element of...   <----------------<
                                          1 + [: i. 1 + +/          sum first n primes, add 1 (so we have enough      |
                                                                    for case n=1) -- make that many natural numbers   |
                           [: (#:@[ , ])/                           reduce them by turning into lists of binary       |
                                                                    digits and catting, however the rightmost number  |
                                                                    won't get reduced, hence the need for ------------^
([: +/                                                              and sum those digits

Try it online!

30 bytes using key (/.): _1({]+//.$$&;<@#:@#\)[:#~p:@i.

super clever.  thanks miles.

JavaScript 1+ + substr, 135 bytes
for(n=prompt(s=P=0),i=n*n*n*8;--i;)s=i.toString(2)+s;for(p=1;n;e=j?s:--n?P+=p:s.substr(P,p))for(j=p++;p%j--;);eval([].join.call(e,'+'))

What do you mean by "4?" are you unsure of the version? Expanding on what you mean in the body would help make this post better.

I know it runs when JS5 didn't come, but not that sure exactly when


text:
Expand an Array
Expand an array to all directions by duplicating the outer elements
You will be given two inputs: an array and the expansion degree
For example if I give you [[1,2,3][4,5,6][7,8,9]] and 3,
you must output:
1 1 1 1 2 3 3 3 3
1 1 1 1 2 3 3 3 3
1 1 1 1 2 3 3 3 3
1 1 1 1 2 3 3 3 3
4 4 4 4 5 6 6 6 6
7 7 7 7 8 9 9 9 9
7 7 7 7 8 9 9 9 9
7 7 7 7 8 9 9 9 9
7 7 7 7 8 9 9 9 9

As you can see the given array is in the center and all the outer elements have expanded:
1 -> 3 times up, 3 times left and also to every position of the upper left corner
2->  3 times up
5->  is not an outer element
etc
here are some more test cases to make things clearer
Input   [[4,5,6]],0

Output
4 5 6

Input  [[1]],2

Output

1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

Input  [[1,2,3]],2

Output
1 1 1 2 3 3 3
1 1 1 2 3 3 3
1 1 1 2 3 3 3
1 1 1 2 3 3 3
1 1 1 2 3 3 3

Input  [[1,2,3][11,22,33][111,222,333][1111,2222,3333]],1

Output
   1       1       2       3       3
   1       1       2       3       3
  11      11      22      33      33
 111     111     222     333     333
1111    1111    2222    3333    3333
1111    1111    2222    3333    3333

You can use as many whitespaces as you like.
But the output has to be a mXn array just like it is shown here.
You cannot output a list of lists.
This is codegolf
Shortest answer on bytes wins

Is output formatted like this valid? (output is in input)

@H.PWiz Yes,it is.

"You cannot output a list of lists." seems like an unnecessary output restriction to me.

Probably so, because the stringize part of my answer takes 41 chars, while the "actual" part only takes 19 chars.

Test cases are not an acceptable alternative to a clear specification.

Octave, 35 bytes
@(a,x)padarray(a,[x x],'replicate')

Try it online!

Is this a builtin in Octave?

@EriktheOutgolfer It belongs to the image processing package.

Matlab, 27 bytes
@(a,n)padarray(a,[n,n],'r')

The key over the Octave solution is that Matlab accepts partial option strings when they are unambiguous.

MATL, 10 bytes
th2Y5I4$Ya

Port of @rahnema1's Octave answer.
Try it online!
Explanation
t      % Implicit input: number, n. Duplicate
h      % Concatenate. Gives an array [n,n]
2Y5    % Push 'replicate' (predefined literal). Will be used as an input flag
I      % Push 3. Will be used as equivalent to an input flag
4$     % Specify that the next function will use 4 inputs
Ya     % Call 'padarray' with 4 inputs. This takes the array as implicit
       % input. Number 3 as third input is interpreted as the input flag
       % 'both'. So the function pads the array (first input) by n in each
       % dimension (second input) by replicating the border (third input) in
       % both directions (fourth input). Implicit display

Explanation please?

@EriktheOutgolfer Added

Jelly, 13 bytes
;ṫ¥0$¡Ṛ$⁺Zµ⁺G

Try it online!

I will NEVER learn how to use Jelly...

05AB1E, 33 28 23 bytes
F2Fø2FR¤¸«]øεD€gZs-ú}ø»

Try it online! 15 10 bytes of actual code, the rest is formatting the output. Explanation:
       ¤                Copy last element
        ¸               Turn it into a list
         «              Concatenate
    2F                  Repeat twice
      R                 Reverse list each time
 2F                     Repeat twice
   ø                    Transpose list each time
F                       Repeat the given number of times
          ]             Close all the loops
           ø            Transpose the array
             D          Duplicate
              €g        Take length of each number
                Z       Get the maximum
                 s-     Subtract each length from the maximum
                   ú    Pad with that number of spaces
            ε       }   For each row (column originally)
                     ø  Transpose back
                      » Join with spaces and newlines

Formatting costs 2 bytes if I copy @ErikTheOutgolfer's output format for 12 bytes:
F2Fø2FR¤¸«]»

Python 2, 138 113 bytes
-9 bytes thanks to @JonathanFrech
-16 bytes thanks to @Lynn
a,n=input()
for e in a[:1]*n+a+n*a[-1:]:print' '.join('%*s'%(len(`max(sum(a,[]))`),n)for n in e[:1]*n+e+n*e[-1:])

Try it online!

129 bytes; using string formatting to pad the output.

113 bytes.

05AB1E, 15 bytes
2F2F¤¸².×«R}ø}»

Try it online!
Yes, this output format is valid.

Python 2.7, 74 characters
Pretty straightforward: uses numpy padding and regex to force a return string without brackets. This code returns an anonymous lambda.
import numpy,re;lambda a,n:re.sub('[\[\]]', '',str(numpy.pad(a,n,'edge')))

Python 2, 94 89 86 82 bytes
a,n=input()
for l in a[:1]*n+a+n*a[-1:]:print' '.join(map(str,l[:1]*n+l+n*l[-1:]))

Try it online!


text:
Alternested numbers
Consider the array of positive integers:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ...

Then, concatenate them:
1234567891011121314151617181920212223242526...

And then split them into chunks of variable length, each length being equal to the Nth positive integer:
[1][23][456][7891][01112][131415][1617181][92021222][324252627][2829303132] ...
---------------------------------------------------------------------------
 1  2    3     4     5       6       7        8          9          10      ...

Task
Given an integer N (positive for 1-indexing or non-negative for 0-indexing), your task is to output the sum of the deltas of the digits in the Nth chunk (the differences between consecutive digits).

Default-forbidden loopholes apply.
Standard Input and Output methods apply.
You may choose either 0 or 1-indexing for N.
The sequence must start with 1.
This is code-golf, shortest code in bytes wins.

Examples & Test cases
1-indexed test cases. If you want 0-indexed ones, just decrement N.
N, Chunk, Deltas, Sum

1  -> 1          -> []                               -> 0
2  -> 23         -> [1]                              -> 1
3  -> 456        -> [1, 1]                           -> 2
4  -> 7891       -> [1, 1, -8]                       -> -6
5  -> 01112      -> [1, 0, 0,1]                      -> 2
6  -> 131415     -> [2, -2, 3, -3, 4]                -> 4
7  -> 1617181    -> [5, -5, 6, -6, 7, -7]            -> 0
8  -> 92021222   -> [-7, -2, 2, -1, 1, 0, 0]         -> -7
9  -> 324252627  -> [-1, 2, -2, 3, -3, 4, -4, 5]     -> 4
10 -> 2829303132 -> [6, -6, 7, -6, -3, 3, -2, 2, -1] -> 0

Puzzle 2 on CodeGolf-Hackathon (I am the original author there too, so I am allowed to repost). Related, Inspiration. Related.

Kinda related but not really

The sum of all the differences between consecutive digits is just the difference between the last and the first.

Husk, 9 bytes
ΣẊ-!SCṁdN

Try it online!
My solution to the Hackathon.
Explanation:
ΣẊ-!SCṁdN⁰
    S      (x -> y -> z):f -> (x -> y):g -> x:x :: return f(x, g(x))
     C      f= [num]:x -> [x]:y -> [x] :: cut y in pieces where each piece has its respective length in x
      ṁ     g= (x -> [y]):f -> ([x]:x -> [y]) :: maps f over x then concatenate
       d     f= num:x -> [num] :: return decimal digits of x
        N   x= sequence of natural numbers [1..]
   !     ⁰ [x]:x -> num:y -> x :: get yth (impl. input) element of x (above result)
 Ẋ         (x -> x -> y):f -> [x]:x -> [y] :: map f over overlapping pairs of x (above result)
  -         f= num:x -> num:y -> num :: return y - x
Σ          [num]:x -> num :: return sum of x (above result)

JavaScript (ES6), 54 53 51 50 bytes
Saved 1 byte thanks to @tsh
0-indexed.
k=>-(n=1,g=s=>s[x=k*-~k/2]-s[x+k]-n||g(s+n++))``-n

Test cases

let f =

k=>-(n=1,g=s=>s[x=k*-~k/2]-s[x+k]-n||g(s+n++))``-n

for(i = 0; i < 10; i++) {
  console.log('a(' + i + ') = ' + f(i));
}

Zero-indexed: k=>-(n=1,g=s=>s[x=k*-~k/2]-s[x+k]-n||g(s+n++))""-n

APL (Dyalog), 32 bytes
{+/2-⍨/⍎¨⍵↑(+/⍳⍵-1)↓' '~⍨⍕⍳+/⍳⍵}

Try it online!
How?
+/⍳⍵ - sum of 1 to n
⍳ - make range of that
' '~⍨⍕ - into string, without spaces
(+/⍳⍵-1)↓ - drop first (sum of 1 to n-1) chars
⍵↑ - keep the next n chars
⍎¨ - make every char into integer
2-⍨/ - differences list (backward subtraction for every 2 items)
+/ - sum it up.

Haskell, 61 60 bytes
l=fromEnum<$>(show=<<[1..])
f n|t<-sum[2..n]=l!!t-l!!(t-n+1)

Try it online!
Explanation:
The sum of the deltas of a list is the same as the difference between the last and the first element.
The last element (zero-indexed) is t, triangle(n)-1 = sum[2..n]. The first element, then is t-n+1, as the list has n elements.

Python 2, 80 bytes
n=input()
s=map(int,''.join(map(str,range(2**n))))
print s[n*-~n/2]-s[~-n*n/2+1]

Try it online!
2**n is way overkill, of course, but it’s a byte shorter than something like n*n+1.

Mathematica, 71 bytes
Tr@Differences[TakeList[Join@@IntegerDigits[Range[#^2]],Range@#][[#]]]&

Try it online!

05AB1E, 8 bytes
∞LJā£è¥O

0-indexed.
Try it online!

JavaScript (ES6), 60 57 53 bytes

f=(n,s=i='',m=n*-~n/2)=>s[m]?s[m]-s[m-n+1]:f(n,s+i++)
<input type=number min=1 oninput=o.textContent=f(this.value)>

1-indexed. Previous 60-byte nonrecursive version:

f=
(n,s=[...Array(n*n+1).keys()].join``)=>s[m=n*-~n/2]-s[m-n+1]
<input type=number min=1 oninput=o.textContent=f(this.value)>

Python 2, 87 bytes
n=input()
a=map(int,''.join(map(str,range(1,n*n))))[n*~-n/2:][:n]or[0]
print a[-1]-a[0]

Try it online!

Vyxal s, 11 bytes
²ɾṅ?ʀʀÞṁi⌊¯

Try it Online!
0-indexed
Explained
²ɾṅ?ʀʀÞṁi⌊¯
²ɾ           # the range [1...input**2]
  ṅ          # joined into a single integer - call it x
   ?ʀ        # the range [0...input]
     ʀ       # [range [0...n] for n in that]
      Þṁ     # reshape x to the shape of that
        i    # get the input(th) item of that
         ⌊   # convert each item to integer
          ¯  # and take the deltas of that
             # the -s flag sums that

Python 2, 104 bytes
def f(N):A=map(int,"".join(map(str,range(1,N*N)))[~-N*N/2:][:N]);return sum(a-b for a,b in zip(A[1:],A))

Try it online!

PHP, 163 147 bytes
$v=$argv[1];for($i=1;$i<=$v*$v;$i++){$s.=$i;$j+=$i<$v?$i:0;}$s=array_slice(str_split($s),$j,$v);for($i=0;$i<$v-1;$i++){$k+=$s[$i+1]-$s[$i];}echo$k;

Try it online!
My first attempt at code golfing... have a feeling that this can be shorter
Edit: saved 16 bytes by removing several instantiations

Welcome to the site! You may want to look through these tips for golfing in PHP

Perl 6,  58  55 bytes
{[+] ($_=(1..*).map(|*.comb).rotor(1..*)[$^a])[1..*]Z-@$_}

Test it
{[+] ($_=(1..*).map(|*.comb)[^$^a+[+] ^$a])[1..*]Z-@$_}

Test it
Expanded:
{ # bare block lambda with placeholder parameter ｢$a｣
  [+]  # reduce using &infix:«+» the following

    (
      $_ =                # store into ｢$_｣ for later use

        ( 1 .. * )        # Range of all positive integers
        .map( | *.comb )\ # split into digits and flatten into single list

        [                 # index into the sequence (1 based)

          ^$^a            # Range up to (and excluding) the input
                          # ｢0 ..^ $a｣ or ｢0 .. $a-1｣

          +               # shift it up by
          [+] ^$a         # the sum of the values up to (and excluding) the input

        ]

    )[ 1 .. *]            # skip the first value

    Z-                    # zip using &infix:«-»

    @$_                   # ｢$_｣ used as a List
}

Perl 5, 79 + 1 (-p) = 80 bytes
$_=substr join('',1..$_**2),$_*($_-1)/2,$_;1while s/(.)(.)/$r+=$2-$1;$2/e;$_=$r

Try it online!

Pyth, 29 27 bytes
Saved 2 bytes thanks to @Mr.Xcoder.
s.+msdc:sm+hd""U*QQKsUQ+QK1

Try it online!

27 bytes pretty sure it can be golfed further...

Jelly, 14 bytes
²RDFṫ³ḶS‘¤ðḣIS

Try it online!
Explanation
²RDFṫ³ḶS‘¤ðḣIS    Main Link
²                  Square input
 R                 Range: [1,2,3,..,n^2]
  D                Digits: [1,2,...,[1,0],[1,1],...]
   F               Flatten list
     ³ḶS‘¤         n(n-1)/2+1
    ṫ              Remove the first n(n-1)/2+1 elements from the list of digits
          ðḣ       Take the first n digits of the list. ð is needed to prevent I from acting on n.
            I      Increment. Take the diferences
             S     Sum

I originally started by taking the range( n(n+1)/2 ) but since you can have extra digits at the end of the list before slicing it I changed it to range(n^2). You have extra digits after 1-9 anyway.

+²HRDFṫÐ€³ḶḣÐ€RS€‘¤ṪðḣIS original (successful but long) attempt


text:
Largest Prime Exponents
Given an integer n >= 2, output the largest exponent in its prime factorization. This is OEIS sequence A051903.
Example
Let n = 144. Its prime factorization is 2^4 * 3^2. The largest exponent is 4.
Test Cases
2 -> 1
3 -> 1
4 -> 2
5 -> 1
6 -> 1
7 -> 1
8 -> 3
9 -> 2
10 -> 1
11 -> 1
12 -> 2
144 -> 4
200 -> 3
500 -> 3
1024 -> 10
3257832488 -> 3

Sandbox

05AB1E, 2 bytes
ÓZ

Try it online!
How?
Ó   exponents of prime factors
 Z  maximum

Python 2, 62 57 56 bytes
lambda n:max(k%n-n%(k/n+2)**(k%n)*n for k in range(n*n))

Try it online!

Recursive version: f=lambda n,k=0:max(k%n-n%(k/n+2)**(k%n)*n,k<n**2and f(n,k+1))

Jelly, 3 bytes
ÆEṀ

Try it online!

ÆEṀ  - Full program / Monadic link.

ÆE   - Array of exponents of prime factorization.
  Ṁ  - Maximum.

This also works in M. Try it online!

Haskell, 61 60 50 48 46 bytes
-2 bytes thanks to xnor
f n=maximum[a|k<-[2..n],a<-[1..n],n`mod`k^a<1]

Try it online!
45 bytes with an import:
import NumberTheory
maximum.map snd.factorize

Try it Online!

The 0^ is cute, but it's shorter to just check the condition as a boolean.

Ohm v2, 2 bytes
n↑

Try it online!
Explanation?
No.

Python 2, 78 bytes
n=input()
e=m=0
f=2
while~-n:q=n%f<1;f+=1-q;e=q*-~e;m=max(m,e);n/=f**q
print m

Try it online!
-5 thanks to ovs.
This answer doesn't do prime checks. Instead, it takes advantage of the fact that the highest exponent of a prime factor will be greater than or equal to the exponent of any other factor in any factorization of a number.

81 bytes

@ovs thanks, missed that while I was trying to post quickly

78 bytes

@ovs finally, got relaxed from the if/else, thanks

Japt -h, 9 7 bytes
k ü mÊn

Try it
k ü mÊn     :Implicit input of integer
k           :Prime factors
  ü         :Group by value
    m       :Map
     Ê      :  Length
      n     :Sort
            :Implicit output of last element

I feel like this should be way shorter, maybe I should add a built-in for prime-exponent pairs...

Why to use "ü          :Group by value" instead of sort function? Yes perhaps because sort return one array but we need one array of arrays...

@RosLuP, Exactly; ü creates sub-arrays of the equal values. It does also sort by value first but that's not relevant here.

Mathematica, 27 bytes
Max[Last/@FactorInteger@#]&

Try it online!

Alternatively, Max@@Last/@FactorInteger@#&. Unfortunately this doesn't save any bytes.

MATL, 4 bytes
YFX>

Try it online!
       % implicit input
YF     % Exponents of prime factors
X>     % maximum
       % implicit output

Husk, 5 bytes
▲mLgp

Try it online!

p – Gets the prime factors.
g – Groups adjacent values.
mL – Gets the lengths of each group.
▲ – Maximum.

Brachylog, 5 bytes
ḋḅlᵐ⌉

Try it online!
Explanation
ḋ          Prime decomposition
 ḅ         Group consecutive equal values
  lᵐ       Map length
    ⌉      Maximum

APL (Dyalog), 19 bytes
⎕CY'dfns'
⌈/1↓2pco⎕

Try it online!
How?
2pco⎕ - 2D array of prime factors and exponents
1↓ - drop the factors
⌈/ - maximum

Javascript 54 bytes
*assuming infinite stack (as do in code-golf challenges)

P=(n,i=2,k)=>i>n?k:n%i?k>(K=P(n,i+1))?k:K:P(n/i,i,-~k)

console.log(P(2 )== 1)
console.log(P(3 )== 1)
console.log(P(4 )== 2)
console.log(P(5 )== 1)
console.log(P(6 )== 1)
console.log(P(7 )== 1)
console.log(P(8 )== 3)
console.log(P(9 )== 2)
console.log(P(10 )== 1)
console.log(P(11 )== 1)
console.log(P(12 )== 2)
console.log(P(144 )== 4)
console.log(P(200 )== 3)
console.log(P(500 )== 3)
console.log(P(1024 )== 10)
//console.log(P(3257832488 )== 3)

PARI/GP, 24 bytes
n->vecmax(factor(n)[,2])

If I do not count the n-> part, it is 21 bytes.

Octave, 25 bytes
@(n)[~,m]=mode(factor(n))

Try it online!
Explanation
factor produces the array of (possibly repeated) prime exponents
The second output of mode gives the number of times that the mode (i.e. the most repeated entry) appears.

Alice, 17 bytes
/o
\i@/w].D:.t$Kq

Try it online!
Explanation
/o
\i@/...

This is just a framework for simple-ish arithmetic programs with decimal I/O. The ... is the actual program, which already has the input on the stack and leaves the output on top of the stack.
Alice actually has built-ins to get the prime factorisation of an integer (even with prime-exponent pairs), but the shortest I've come up with using those is 10 bytes longer than this.
Instead the idea is that we repeatedly divide one copy of each distinct prime factor out of the input, until we reach 1. The number of steps this takes is equal to the largest prime exponent. We'll be abusing the tape head as the counter variable.
w      Remember the current IP position. Effectively starts a loop.
  ]      Move the tape head to the right, which increments our counter.
  .D     Duplicate the current value, and deduplicate its prime factors.
         That means, we'll get a number which is the product of the value's
         unique prime factors. For example 144 = 2^4 * 3^2 would become
         6 = 2 * 3.
  :      Divide the value by its deduplicated version, which decrements the
         exponents of its prime factors.
  .t     Duplicate the result and decrement it. This value becomes 0 once we
         reach a result of 1, which is when we want to terminate the loop.
$K     Jump back to the beginning of the loop if the previous value wasn't 0.
q      Retrieve the tape head's position, i.e. the number of steps we've taken
       through the above loop.

Julia, 60 52 40 bytes
f(x)=maximum(collect(values(factor(x))))

-12 +correction thanks to Steadybox

I think you need to add a call to print(). Also, I couldn't get the code to run on TIO as is, I assume it works on some other version of the language not available there? This runs fine on TIO: print(maximum(collect(values(factor(parse(BigInt,readline()))))))

This works on the interpreter (on my computer, at least). It also causes a warning because initializing a BigInt like that has been deprecated. Nonetheless, if you copy and paste the code as-is into a Julia interpreter, it should work. (if a print is required because it has to explicitly be printed, ill put that in)

The print() is needed because the answer needs to be a full program (that displays the output) or a function (that returns the output). Otherwise your solution is fine. It seems that you can save some bytes (and avoid the print) this way: f(x)=maximum(collect(values(factor(x))))

You're welcome! Here's a meta post on what is the allowed format for a solution.

Pyth, 7 bytes
eShMr8P

Try it here.

Alternatives: eS/LPQP (7 bytes), eSlM.gkP (8 bytes).

Python 2, 90 84 bytes
f=lambda n,i=2,l=[0]:(n<2)*max(map(l.count,l))or n%i and f(n,i+1,l)or f(n/i,2,l+[i])

Try it online!

Gaia, 4 bytes
ḋ)⌠)

Try it online!

ḋ - Computes the prime factorization as [prime, exponent] pairs.

⌠ - Map and collect the result with the maximal value.
) - Last element (exponent).
) - Last element (maximal exponent)

Gaia, 4 bytes
ḋ)¦⌉

Try it online!

ḋ - Computes the prime factorization as [prime, exponent] pairs.

)¦ - Map with the last element (exponent).
⌉ - Gets the maximum element.

MY, 4 bytes
ωĖ⍐←

Try it online!
Explanation?
ωĖ⍐←
ω    = argument
 Ė   = prime exponents
  ⍐  = maximum
   ← = output without a newline

Octave: 30 bytes
@(x)max(histc(a=factor(x),a));

a=factor(x) returns a vector containing the prime factors of x.  This is a vector sorted in ascending order where the multiplication of all numbers in factor(x) yields x itself such that each number in the vector is prime.
histc(...,a) calculates a histogram on the prime factor vector where the bins are the prime factors. The histogram counts up how many times we have seen each prime number thus yielding the exponent of each prime number.  We can cheat here a bit because even though factor(x) will return duplicate numbers or bins, only one of the bins will capture the total amount of times we see a prime number.
max(...) thus returns the largest exponent.

Try it online!

Racket, 83 79 bytes
(λ(n)(cadr(argmax cadr((let()(local-require math/number-theory)factorize)n))))

Try it online!
(I'm not sure if there's a consensus on what constitutes a complete Racket solution, so I'm going with the Mathematica convention that a pure function counts.)
How it works
factorize gives the factorization as a list of pairs: (factorize 108) gives '((2 2) (3 3)). The second element of a pair is given by cadr, a shorthand for the composition of car (head of a list) with cdr (tail of a list).
I feel silly doing (cadr (argmax cadr list)) to find the maximum of the second elements, but max doesn't work on lists: (max (map cadr list)) doesn't do what we want. I'm not an expert in Racket, so maybe there's a standard better way to do this.
Racket, 93 bytes
(λ(n)(define(p d m)(if(=(gcd m d)d)(+(p d(/ m d))1)0))(p(argmax(λ(d)(p d n))(range 2 n))n))

Try it online!
How it works
An alternative version that doesn't import factorize and instead does everything from scratch, more or less. The function (p m d) finds the highest power of d that divides m and then we just find highest value of (p n d) for d between 2 and n. (We don't need to restrict this to primes, since there will not be a composite power that works better than prime powers.)

I guess the standard max solution is (apply max (map cadr list) but (cadr (argmax cadr list)) is unfortunately shorter.

J, 9 bytes
[:>./_&q:

Max of <./ all prime exponents _&q:
Try it online!

Actually, 4 bytes
w♂NM

Try it online!

w♂NM  - Full program.

w     - Pushes the prime factorization as [prime, exponent] pairs.
 ♂N   - Get the last element of each (the exponents).
   M  - Maximum.

I used this exact solution for writing the test cases :)

@Mego Do you think it can get shorter (I don't want you to spoil if you have a shorter one, just asking)? :)

No, I believe this is optimal for Actually.

Python 2, 64 bytes
-4 bytes thanks to H.PWiz.
lambda n:max(a*(n%k**a<1)for a in range(n)for k in range(2,-~n))

Try it online!
Port of H.PWiz's Haskell answer. I'm only sharing this because I'm proud that I was able to understand this piece of Haskell code and translate it. :P

Does range(1,n) not work?

range(1, n) produces all integers in [1, n).

Ah, well you don't actually need to go all the way up to n for a

Oh, okay, I don't completely understand the math behind it. :P Thanks!

64 bytes

Axiom, 61 bytes
f n==(a:=factors n;reduce(max,[a.i.exponent for i in 1..#a]))

This is the first time i find it is possible define the function
without the use of () parenthesis. Instead of "f(n)==" "f n=="
one character less...

APL(NARS), 15 chars, 30 bytes
{⌈/+/¨v∘=¨v←π⍵}

test:
  f←{⌈/+/¨v∘=¨v←π⍵}
  f¨2..12
1 1 2 1 1 1 3 2 1 1 2
  f¨144 200 500 1024 3257832488
4 3 3 10 3

comment:
{⌈/+/¨v∘=¨v←π⍵}
          v←π⍵    π12 return 2 2 3; assign to v the array of prime divisors of argument ⍵
      v∘=¨        for each element of v, build one binary array, show with 1 where are in v array, else puts 0
                  return one big array I call B, where each element is the binary array above
   +/¨            sum each binary element array of  B
 ⌈/               get the max of all element of B (that should be the max exponet)


text:
Drawing a square with an 'x' inside
Task:

Make a program that draws the following figure line by line.
Your program should wait for one-second after drawing each line(it can be longer, just has to be a noticeable difference) .
Your program can only draw line by line (you cannot jump to another point or re-draw over a line)
Given a positive integer n, produce an art image of the below drawing
The angle measures should always be the same (regardless of n's value)
However, each line's length should be 150*n pixels
You only need to account for when n = 1, n = 2, n = 3

The picture below shows when n = 1
(You don't have to include the angles and side lengths in your drawing - they are just guides)

Answering
- Name the language you used followed by its bytes
Example:

Java (swing), 500 bytes

Scoring

This is code golf. Lowest score (bytes) wins.
standard loopholes are forbidden.

Good luck!

Can you make the specifics of the dimensions etc more clear?

Would you mind showing a diagram of how long the lines should be, the angles, etc. Otherwise this may be closed as unclear.

What is the 75px labeling? And are the 150px supposed to be 150*n?

The picture shows what would be drawn if n = 1

@xnor the 75px is labeling the inner x

Despite the revisions, this looks far underspecified to me. Does the drawing have to be a single image that is modified on screen, on can it be a sequence of images that draw more and more? Do the drawn segments have to form a single Eulerian path? Does drawing a line segment mean tracing it gradually, or can it just appear at once? Does our drawing need to include the angle and length labels, or are those just guides?

Length 75px for the inner X segments seems geometrically impossible.

@xnor In my mind it was to be a single image which you would add to without tracing over another line. However, you can do a sequence if you wish. The angle and length labels are just guides. I am fixing the drawing as your last statement was correct

Python 2, 150 140 132 120 bytes
-5 bytes thanks to @Mr.Xcoder
from turtle import*
n=150*input()
for a,b in zip([0,90,30,120,30]+[135]*3+[-75,240],[n]*5+[2**.5*n,n]*2+[n]):rt(a);fd(b)

Try it on Trinket modified slightly to run with Python 3

Thi is exactly what I meant! I just wanted to combine a fun math problem I saw with coding. You understood the prompt and did it exactly as I imagined!

Can’t see the output.

@FrownyFrog you need to enter a number into the input field in the bottom right after pressing run

You updated the byte count and links, but forgot to change the code...


text:
Any digital permutation
Task
Your task is to output a single integer, with one restriction: its digits must be a permutation of [1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6].
For example, you could output 653443653152432, 413265345463352, or any of the other 15-digit integers whose digits are a permutation of the list.
Rules

Your code must terminate in a reasonable amount of time (do not just enumerate every integer until you get to 122333344455566).

If your language doesn't support 15-digit integers, or if there is no meaningful distinction between strings and integers in your language, you may output a string.

This is code-golf, shortest answer in bytes wins.

What's to stop me simply outputting 653443653152432?

Because you could do it in fewer bytes than just writing out the integer.

Would be more interesting if we had to a random one of all the permutations, with equal chance for each.

"Reasonable amount of time" tha'ts pretty vague, you need to set a limit.  Even seomthing like 30 seconds or 15 works.

If we output to STDOUT (or STDERR) then there surely is no difference between printing a string or a number, no?

Is there any reason that particular set of digits was chosen? Or is it arbitrary?

Reminder: Don't upvote trivial answers.  Upvote if somebody solves this in, say, boolfuck.

I suspect that you found some short expression that gives a number with the right digits before posting this. I'd suggest against such puzzles. It's more about finding the expression you had in mind that golfing code, and once someone has the expression, probably everyone can copy it into other languages.

@xnor I personally think that this challenge is underrated. If I did my math correctly, there are 378,378,000 possible outcomes. Even if the OP found a terse expression for one of them, it is quite possible that a shorter one exists for another permutation.

JavaScript (ES7), 13 12 bytes

let f =

_=>266**6+19

console.log(f())

This computes: 2666 + 19 = 354233654641216 + 19 = 354233654641235
There are two triples (a, b, c) with 0 < a < 1000, 0 < b < 10, 0 < c < 100 and ab + c satisfying the condition.
The following snippet finds them almost instantly.

for(a = 1; a < 1000; a++) {
  for(b = 1; b < 10; b++) {
    for(c = 1; c < 100; c++) {
      if((r = a**b + c + '').match(/^[1-6]+$/) && [...r].sort().join`` == '122333344455566') {
        console.log(a + '**' + b + ' + ' + c + ' = ' + r);
      }
    }
  }
}

Tcl sucks using your approach: https://tio.run/##K0nO@f@/oLSkWCE6taKgSMHIzExLy0zb0DL2/38A

Brain-Flak, 65 bytes
(((((((((((((((((((()()()){}){}){}){}())()))()))))())))())))()))

Try it online!
This is 64 bytes of source code and +1 for the -A flag. This simply pushes the ASCII values of each digit in a row. For reference, pushing the number 122333344455566 would take 238 bytes:
(((((((((((((((((((((((((((((((((((((((((((((((((()()()){}){}){})()){}{}){({}[()])}{}){}){}())){}{})){}{}){}())){}{})()){}{})){}{}){}())){}{}){}())){}{}){}())()){}{})()){}{})){}{})()){}{})()){}{})){}{}){}())){}{}){}())){}{})){}{}){}()){})

Try it online!

V, 12, 10 bytes
2¬26¬35a13

Try it online!
This generates the range [2, 6] twice, then the range [3, 5], and then appends 13.
Outputs:
234562345634513

Turing machine, 132 122 bytes
...and 11 10 8 7 states, including halt.
0 _ x r A
0 x y r A
0 y z r A
0 z _ r C
0 * * l 0
A _ 6 r B
A * * r A
B _ 2 r C
C * 3 r D
D _ 4 r E
D 2 1 l halt
E _ 5 l 0

Here is a Turing machine simulator that understands this syntax. You should paste the code, clear the "Initial input" field, press Reset, then press Run.
How it works
Outputs 313456234562345 by looping to write 62345 three times and then writing 31 on top of the initial 62.

-10 bytes thanks to @Leo

Befunge-93, 16 14 or 12 bytes
The only native integer literals supported by Befunge are the numbers 0 to 9, so coming up with an efficient representation for larger values is actually quite a common problem. In this case, though, it's not just a matter of finding the most efficient representation for a number, but also choosing a target number whose best representation is the shortest of all possible targets.
After trying thousands of different combinations, the best I've been able to do so far is 14 bytes (12 to calculate the number, and then two more bytes to output it).
m&"7*:*::**+.@

Try it online!
If we allow extended ASCII characters, though, we can improve on the above solution by two bytes with:
eûãÃ"**:*+.@

This is using the Latin-1 encoding, which we unfortunately can't demonstrate on TIO, since it doesn't support 8-byte encodings for the Befunge interpreters.
Explanation
In the first answer, we start with the string "m&", which essentially pushes the values 109 and 38 onto the stack. Note that we save a byte by dropping the opening quote, since we can rely on Befunge's wrap-around playfield to have the one quote both open and close the string (this pushes a number of additional values onto the stack that we don't need, but we only care about the final two).
We then push an additional 7 onto the stack, and execute the sequence *:*::**+, which performs a set of arithmetic calculations with the stack values, essentially calculating the expression:
109+(38*7)^2^3 = 354233654641325

Finally we use the . instruction to output the result of the calculation, and then the @ instruction ends the program.
In the second answer, we start with the string "eûãÃ", which pushes the values 101, 251, 227 and 195. We then execute the sequence **:*+, which performs the required calculations on those values:
101+(251*227*195)^2 = 123443543565326

And again we finish with the instructions . and @ to output the result and exit.
Note that in both cases you need to be using an interpreter which supports 64-bit integers. Also note that the string wrapping trick won't work on Befunge-98 interpreters, since it relies on the interpreter ignoring instructions it doesn't recognise, but in Befunge-98 an invalid instruction will reflect.

Jelly, 9 8 bytes
“|BS½GA’

Try it online!
Simply a base-250 compressed version of the number 122333344455566
Saved 1 byte thanks to @Mr. Xcoder

8 bytes: “|BS½GA’

@Mr.Xcoder why didn't I try that one first? :P Thanks

SOGL V0.12, 7 bytes
↓čvν□⅟“

Try it Here!
A simple compressed number.
Alternate 9 byte run-length version:
Ƨ≡+‰“7─◄H

Try it Here!

brainfuck, 40 bytes
+++++++[>+++++++<-]>.+..+....+...+...+..

Try it online!
fairly boring solution

05AB1E, 7 bytes
•=["∊…Q

Try it online!

1243ƶ would've been cool if there were 5 and 6 times a number.

Vyxal, 7 bytes
»Ċ¨?»²›

Try it Online!
Port of the second answer here
Explanation:
»Ċ¨?»   # Compressed integer 11972312
     ²  # Squared
      › # Increment

I was on my way to making a super short one but I had read the rules wrong :(

Tcl, 89 bytes
proc f a\ b {expr rand()>.5}
puts [join [lsort -command f [split 122333344455566 ""]] ""]

Try it online!

Tcl, 20 bytes
puts 122333344455566

Try it online!

Befunge-98 (FBBI), 20 bytes
"ek,@122333344455566

Try it online!
Output is 665554443333221.

Groovy, 23 bytes
{"233456"*2+145}

Outputs: 233456233456145

APL (Dyalog Unicode), 14 bytes
⎕pp←30
37+266*6

Try it online!
Used @Arnauld's snippet, so credit goes to them.

Python 2, 21 bytes
print 122333344455566

Try it online!

print 0x6f42f38a5b8e

Jelly, 12 bytes
4967b5Ėẋ/€FḌ

Try it online!
could probably be shorter

Pyth, 9 bytes
."16U<³

Try it here!
Output:
223133344455566

C++, 24 bytes
[]{return(57LL<<41)-31;}

Try it online!
Returns 57×241−31 = 125344325566433.

ARM T32 machine code, 8 bytes
20d5 f24e 6157 4770

Following the AAPCS, this is a function returning a 64-bit integer in r0 and r1. The number is 58967×232+213=253261336543445.
Disassembled:
20d5        movs    r0, #213
f24e 6157   movw    r1, #58967
4770        bx  lr

A0A0, 16 bytes
O122333344455566

O outputs the number after it. The number after it is a valid integer.
I don't really think it's possible to save bytes by using some arithmetic expression. When multiplying two numbers of n and m digits, the resulting length of the multiplication will be at most n + m. Doing such a multiplication requires at least n + m + 2 (ignoring the operand) bytes, at which point you might as well just write the result directly. Addition is even worse in terms of length. Considering multiplication, addition and subtraction are the only built-in operators I find it hard to believe this can be shortened. I'd love to be proven wrong, though.

x86 32-bit machine code, 9 bytes
6A 85 58 BA 4F C9 00 00 C3

Returns a 64-bit integer in EDX and EAX, as is standard. The value is 51536×232−123 = 221345434566533.
Try it online!
In assembly:
f:  push -123; pop eax
    mov edx, 51535
    ret

Some alternatives that also take 9 bytes:

B8 D8 AE B6 00 F7 E0 40 C3

Try it online!
f:  mov eax, 11972312
    mul eax
    inc eax
    ret

119723122+1 = 143336254625343

6A E1 58 0F B6 D4 B6 71 C3

Try it online!
f:  push -31; pop eax
    movzx edx, ah
    mov dh, 113
    ret

114×240−31 = 125344325566433