# Question
Title: Cap the highest values in a list so that the sum equals a given number
A slightly more challenging one compared to my previous challenge. Given a list of positive integers (\>0) and the positive integer `m`, output a list of positive integers that are capped values of the input values so that the sum of the capped values equals `m`. Cap the highest values first. And keep the same order.

**Cases**

(Given 'list' and 'sum' output 'list')

* Given `4, 2` and `6` output `4, 2` no capping needed (ncn), keep order (ko)
* Given `2, 4` and `6` output `2, 4` ncn, ko
* Given `3, 3` and `6` output `3, 3` ncn
* Given `3, 3` and `7` output `3, 3` ncn

Then this:

* Given `4, 2` and `5` output `3, 2` cap the highest (cth), ko
* Given `2, 4` and `5` output `2, 3` cth, ko
* Given `3, 3` and `5` output `3, 2` or `2, 3` cap any of the highest (cath)

Then this:

* Given `5, 4, 2` and `10` output `4, 4, 2` cth, ko
* Given `2, 4, 5` and `10` output `2, 4, 4` cth, ko
* Given `4, 4, 2` and `7` output `3, 2, 2` or `2, 3, 2` cth, cath, ko
* Given `4, 2, 4` and `7` output `3, 2, 2` or `2, 2, 3` cth, cath, ko

Then this:

* Given `4, 4, 2` and `5` output `2, 2, 1` or any permutation (oap)
* Given `2, 4, 4` and `5` output `1, 2, 2` oap
* Given `4, 4, 2` and `4` output `1, 2, 1` oap
* Given `2, 4, 4` and `4` output `1, 1, 2` oap
* Given `70, 80, 90` and `10` output `3, 3, 4` oap

Then this:

* Given `4, 2, 4` and `2` output an error or a falsy value, because the sum of 3 positive integers cannot be 2.

**Rules**

* Both input and output are all about positive integers (\>0)
* The number of values in the input and output list are equal.
* The sum of the output values is exactly equal to `m` or less than `m` only if the sum of the input values was already lower.
* If the sum of the values in the input list is already lower then or equal to `m`, no capping is needed. (ncn)
* Cap the highest values first (cth)
* When multiple values are the highest value and equally high, it doesn't matter which you cap. (cath)
* The capped values in the output list have to be in the same order as their original values in the input list. (ko)
* When at some point (thinking iteratively) all values are equally high, it stops being important which you cap.
* If there's no solution output an error or a falsy value.

**The winner**

The shortest valid answer - measured in bytes - wins.

Apart form the rules, I'm interested to see a program that keeps a value intact as long as possible. Consider the input values a plant each with the heights `10,2,10` and the maximum `m`=5, it would be a waste to cap the baby plant in the middle.

# Answer
> 1 votes
# Jelly, 17 bytes

```
œṡṀ‘jṀ’µS>⁴µ¿¹0Ạ?

```

Try it online!

Uses iterative approach: repetitively subtract 1 from the highest element.

```
œṡṀ‘jṀ’µS>⁴µ¿¹0Ạ? - Main link. First input list, second input integer.
           µ¿       - While:
        S             - Sum of the list
         >            - greater than
          ⁴           - second input
       µ            - Do:
œṡ                    - split list by first occurrence of
  Ṁ                   - the maximum element
   ‘                  - increment all
    j                 - join by
     Ṁ                - maximum element
      ’               - increment
                ?   - If:
               Ạ      - no elements are non-zero
             ¹        - Then: output the list
              0       - Else: return 0.

```

# Answer
> 4 votes
# Python 3, 70 77 56 bytes

-21 bytes thanks to Jonathan Allan!

```
def f(l,n):
 while n/all(l)<sum(l):l[l.index(max(l))]-=1

```

Try it online!

# Answer
> 3 votes
# PHP\>=7.1, 94 bytes

```
<?for([$a,$s]=$_GET;array_sum($a)>$s;)$a[array_flip($a)[max($a)]]--;print_r(min($a)?$a:0);

```

replace `array_flip($a)[max($a)]` with `array_search(max($a),$a)` to cap the last/first item with the maximum value

PHP Sandbox Online

# Answer
> 2 votes
# Mathematica, 79 bytes

```
(u:=Plus@@a;For[a=#2,u>#,a[[#&@@a~Position~Max@a]]--];Min@a>0&&u==#||Quit[];a)&

```

Takes `sum` and `List of integers`

# Answer
> 2 votes
# Haskell, 53 bytes

`c` takes an integer and a list of integers, returning a list of integers. Use as `c 6 [4,2]`.

```
c n=until((<=n).sum)f
f(x:y)|any(>x)y=x:f y|x>1=x-1:y

```

Try it online!

# How it works

* `c n` applies `f` to its (implicit) list argument until its sum is `<= n`.
* `f` takes and returns a list of integers. It finds the first maximum value in the list by recursing, and then reduces it by 1, unless the maximum is `<=1`, in which case a non-exhaustive patterns error is raised.

# Answer
> 2 votes
# , ~~61~~ 56 bytes

*-5 bytes thanks to Leaky Nun*

```
function(l,s){while(sum(l)>s)l[which.max(l)]=max(l)-1;l}

```

Anonymous function. Returns a vector with first entry zero (falsey in R) for invalid input.

Try it online!

# Answer
> 2 votes
# Jelly, 17 bytes

*Note:* this solution was ready just as the question was put on hold 33 hours ago.

```
_MḢ$¦S>¥
ç⁹$ÐLẠȧ$

```

A dyadic link returning the list of positive integers or `0`
(an error rather than `0` is also possible by moving `Ạȧ$` from the end of the second line to the end of the first line).

**Try it online!** or see a test suite.

### How?

```
_MḢ$¦S>¥ - Link 1, single conditional decrement: list a; number m
         -     ...subtracts 1 from the first maximal element of a if sum(a)>m
         -   else subtracts 0 from the first maximal element of a
       ¥ - last two links as a dyad (left=a; right=m)
     S   -   sum(a)
      >  -   greater than m? (1 if it is, 0 otherwise) - call this x
    ¦    - sparse application of:
_        -   body:       subtraction (left=a; right=x)
   $     -   at indexes: last two links as a monad:
 M       -     indexes of maximal elements
  Ḣ      -     head

ç⁹$ÐLẠȧ$ - Link: list a; number m
   ÐL    - loop until the result does not change:
  $      - last two links as a monad:
 ⁹       -   chain's right argument, m
ç        -   call the last link as a dyad (left=current_a; right=m)
       $ - last two links as a monad:
     Ạ   -   all truthy? (0 if any of the final a's elements are 0)
      ȧ  -   logical and (if all were truthy yield the final a, otherwise 0)

```

# Answer
> 1 votes
# CJam, 30 bytes

```
{_2$:+<{\__:e>_@#\(t\F}{;}?}:F

```

This is essentially of a named function, F, that expects a list and a number on the stack and returns a list on the stack.

Try it online! or run a test suite

### Explanation

I'll refer to the list as `l` and the number as `n`.

```
_      e# Copy n.
2$     e# Copy l.
:+     e# Sum l.
<      e# Check if n < sum(l).
{      e# If it is:
 \__   e#  Bring l to the top of stack and make 2 copies of it.
 :e>_  e#  Get the maximum number in l and copy it.
 @#    e#  Bring l back to the top and find the index of max(l) in l.
 \(    e#  Decrement max(l).
 t     e#  Set the element of l at the position of max(l) to max(l)-1.
 \     e#  Swap, so now the top of the stack has the new l just under n.
 F     e#  Call F again on the new l and n.
}{     e# Else:
 ;     e#  Delete n.
}?     e# (end if)

```

---
Tags: code-golf, number
---


title: Code Golfinator-3000

text:
# Question
Title: Code Golfinator-3000
As everyone knows, adding `inator-3000` to the end of any noun makes it way cooler. But what else can make a word cooler?

Given an ASCII string as input, output the ***coolness*** of the word.

## Calculating the coolness

There are 4 elements to calculating the coolness of a word.

* The word itself. The base score is the number of capital letters multiplied by 1000
* The end number. A number at the end of the word (such as burninator-**3000**) is added to the base score, **but** if the number is more than 4 digits, they're being too greedy and the number should be ignored.
* The connector. A space before the end number adds 1000, while a hyphen adds 2000, any other symbol, or no symbol at all, has no effect.
* The suffix. If the word ends in `ator`, double the final score. If it ends in `inator`, triple the score. These are case insensitive.

So for example `Burninator-3000` can be calculated as follows:

```
1 Capital letter - Base Score: 1000
(1000(base) + 3000(number) + 2000(hyphen)) * 3(suffix) = 18000

```

## Testcases

```
Burninator-3000 -> 18000
Burnator3000 -> 8000
BurNinator 100 -> 9300
BuRnInAtOr-7253 -> 42759
burn -> 0
burn- -> 0
bUrn-1 -> 3001
inator-7 -> 6021
ator 56 -> 2112
burninators 1000 -> 2000
burn_1000 -> 1000
BURNINATOR-9999 -> 65997
burninator 99999 -> 3000
burninator_99999 -> 0
Code Golfinator-3000 -> 21000
inator ator hello world-1000 -> 3000
javaiscool_99999 -> 0
hypen-ated -> 0
1000 -> 1000
-1000 -> 3000
10000 -> 0
-10000 -> 2000
BURN1N470R-3000 -> 11000

```

## Scoring

This is , so fewest bytes **in each language** wins!

# Answer
> 13 votes
## JavaScript (ES6), ~~138~~ ~~133~~ 128 bytes

```
s=>(([,a,b,,c,d]=s.match(/((in)?ator)?((\D?)(\d+))?$/i),s.split(/[A-Z]/).length-1+(c=='-'?2:c==' '))*1e3+(d<1e4&&+d))*(b?3:2-!a)

```

### How?

The number of capital letters is given by:

```
s.split(/[A-Z]/).length - 1

```

All other criteria are deduced from the result of the following regular expression, which is split into 4 variables:

```
/((in)?ator)?((\D?)(\d+))?$/i     criterion  | code                    | outcome
 \_________/  \___/\___/          -----------+-------------------------+----------
      a         c    d            end number | d < 1e4 && +d           | 0 or +d
  \___/                           connector  | c == '-' ? 2 : c == ' ' | 0, 1 or 2
    b                             suffix     | * (b ? 3 : 2 - !a)      | 1, 2 or 3

```

### Test cases

```
let f =

s=>(([,a,b,,c,d]=s.match(/((in)?ator)?((\D?)(\d+))?$/i),s.split(/[A-Z]/).length-1+(c=='-'?2:c==' '))*1e3+(d<1e4&&+d))*(b?3:2-!a)

let test = s => console.log((s + ' '.repeat(32)).slice(0, 32), f(s));

test("Burninator-3000")               // -> 18000
test("Burnator3000")                  // -> 8000
test("BurNinator 100")                // -> 9300
test("BuRnInAtOr-7253")               // -> 42759
test("burn")                          // -> 0
test("burn-")                         // -> 0
test("bUrn-1")                        // -> 3001
test("inator-7")                      // -> 6021
test("ator 56")                       // -> 2112
test("burninators 1000")              // -> 2000
test("burn_1000")                     // -> 1000
test("BURNINATOR-9999")               // -> 65997
test("burninator 99999")              // -> 3000
test("burninator_99999")              // -> 0
test("Code Golfinator-3000")          // -> 21000
test("inator ator hello world-1000")  // -> 3000
test("javaiscool_99999")              // -> 0
test("hypen-ated")                    // -> 0
test("1000")                          // -> 1000
test("-1000")                         // -> 3000
test("10000")                         // -> 0
test("-10000")                        // -> 2000
test("BURN1N470R-3000")               // -> 11000
```

# Answer
> 7 votes
# Vanilla C, 447 bytes

(Wrapped for readability)

```
#include<stdio.h>
int main(int c,char**a){char*v=a[1];while(*v++);int m=0,i=
0,bn=0,s=0,b=0,mul=1;char l[256],*lp=l;v--;while(a[1]<v--)
{if(!m){i=!i?1:(i*10),('0'<=*v&&*v<='9')?(bn=bn+i*(*v-'0')
):m++;}if(m==1){(*v=='-'||*v==' ')?(s+=bn?((*v=='-')?2000:
1000):0,v--):0,m++;}if(m==2){(*v>='A'&&*v<='Z')?(s+=1000,*
v+=32):0,*lp++=*v;}}s+=(bn<10000)?bn:0;for(i=0;i<lp-l;i++)
{if(*(l+i)=="rotani"[i]){mul=(i==5)?3:((i==3)?2:mul);}}s*=
mul;printf("%d\n",s);}

```

...or even... Friday mood!

*(I didn't use any tools for alying the code. Actually, I'm really lucky I picked right column widths without any precalculations. And it even compiles!)*

# Vanilla C, 789 bytes

```
#include<stdio.h>
int main(int c,     char**a){char       *v=a[1];while      (*v++);int m=0,i=
        0,bn=0,     s=0,     b=0,       mul=1   ;char      l[256],    *lp=l;
          v--;      while  (a[1]<       v--)    {if(!      m){i=!i    ?1:(i*
          10),      ('0'   <=*v&&       *v<=    '9')?      (bn=bn+    i*(*v-
'0')):m++;}if(      m==1)  {(*v==       '-'||    *v==      ' ')?(s    +=bn?(
(*v=='-')?2000      :1000) :0,v--       ):0,m    ++;}      if(m==2     ){(*v
       >='A'&&      *v<=    'Z')?       (s+=    1000,      *v+=32)    :0,*lp
          ++=*      v;}}s  +=(bn<       10000   )?bn:      0;for(i     =0;i<
         lp-l;      i++){  if(*(l       +i)==   "rot"      "ani"[i]   ){mul=
(i==5) ?3: ((i      ==3)?2:mul);}       } s *= mul;        printf("%d\n",s);}

```

Original code:

```
#include <stdio.h>
#include <math.h>

int main(int argc, char** argv) {
    char *v = argv[1];
    while(*v++);
    int m=0,i=-1;
    int bonus_number=0;
    int score=0;
    int b=0;
    int mul=1;
    char letters[256];
    char* lp=letters;
    v--;
    while(argv[1]<v--) {
        printf(" * %c %x\n", *v, *v);
        if (m == 0) {
            if ('0'<=*v&&*v<='9') {
                bonus_number=bonus_number+powl(10,++i)*(*v-'0');
                printf("Digit, bonus is now %d\n", bonus_number);
            } else {
                m++;
            }
        }
        if (m == 1) {
            if (*v=='-'||*v==' ') {
                printf("Dash/space\n");
                if (bonus_number) score += (*v=='-') ? 2000 : 1000;
                v--;
            }
            m++;
        }
        if (m == 2) {
            if(*v>='A'&&*v<='Z') {
                printf("Upper letter\n");
                score += 1000;
                *v += 32;
            }
            *lp++ = *v;
        }
    }
    score += (bonus_number<10000)?bonus_number:0;
    for(i=0;i<lp-letters;i++) {
        // printf("%d: %c\n\n", i, *(letters+i));
        if (*(letters+i) == "rotani"[i]) {
            if (i == 3) {
                printf("2x!\n");
                mul = 2;
            }
            if (i == 5) {
                printf("3x!\n");
                mul = 3;
            }
        }
    }
    score *= mul;
    printf("Score: \n%d\n", score);
}

```

After 1st minimization:

```
#include <stdio.h>

int main(int c, char** a) {
    char *v = a[1];while(*v++);
    int m=0,i=0,bn=0,s=0,b=0,mul=1;
    char l[256],*lp=l;
    v--;
    while(a[1]<v--) {
        if (!m) {
            i=!i?1:(i*10),
            ('0'<=*v&&*v<='9') ? (bn=bn+i*(*v-'0')) : m++;
        }
        if (m == 1) {
            (*v=='-'||*v==' ') ? (s += bn ? ((*v=='-') ? 2000 : 1000) : 0, v--):0,m++;
        }
        if (m == 2) {
            (*v>='A'&&*v<='Z') ? (s += 1000, *v += 32):0,
            *lp++ = *v;
        }
    }
    s += (bn<10000)?bn:0;
    for(i=0;i<lp-l;i++) {
        if (*(l+i) == "rotani"[i]) {
            mul=(i==5)?3:((i==3)?2:mul);
        }
    }
    s *= mul;
    printf("%d\n", s);
}

```

# Test cases

```
#!/usr/bin/env python3
import subprocess

TESTCASES = '''
Burninator-3000 -> 18000
Burnator3000 -> 8000
BurNinator 100 -> 9300
BuRnInAtOr-7253 -> 42759
burn -> 0
burn- -> 0
bUrn-1 -> 3001
inator-7 -> 6021
ator 56 -> 2112
burninators 1000 -> 2000
burn_1000 -> 1000
BURNINATOR-9999 -> 65997
burninator 99999 -> 3000
burninator_99999 -> 0
Code Golfinator-3000 -> 21000
inator ator hello world-1000 -> 3000
javaiscool_99999 -> 0
hypen-ated -> 0
1000 -> 1000
-1000 -> 3000
10000 -> 0
-10000 -> 2000
BURN1N470R-3000 -> 11000
'''

TESTCASES = dict(map(lambda x: x.split(' -> '), filter(None, TESTCASES.split('\n'))))

def process(arg):
    return subprocess.Popen(['./a.out', arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].strip().split(b'\n')[-1].decode('utf-8')

for key, value in TESTCASES.items():
    assert value == process(key), '"{}" should yield {}, but got {}'.format(
        key, value, process(key)
    )

```

# Answer
> 2 votes
# C#, ~~322~~ 317 bytes

```
namespace System.Linq{s=>{var m=Text.RegularExpressions.Regex.Match(s,"(.*?)([- ])?(\\d+)$");string t=m.Groups[1].Value.ToLower(),c=m.Groups[2].Value,n=m.Groups[3].Value;return(s.Count(char.IsUpper)*1000+(n.Length>4|n==""?0:int.Parse(n))+(c==" "?1000:c=="-"?2000:0))*(t.EndsWith("inator")?3:t.EndsWith("ator")?2:1);}}

```

Try it online!

Full/Formatted Version:

```
namespace System.Linq
{
    class P
    {
        static void Main()
        {
            Func<string, int> f = s =>
            {
                var m = Text.RegularExpressions.Regex.Match(s, "(.*?)([- ])?(\\d+)$");
                string t = m.Groups[1].Value.ToLower(), c = m.Groups[2].Value, n = m.Groups[3].Value;

                return (
                           s.Count(char.IsUpper) * 1000 +
                           (n.Length > 4 | n == "" ? 0 : int.Parse(n)) +
                           (c == " " ? 1000 : c == "-" ? 2000 : 0)
                        )
                        * (t.EndsWith("inator") ? 3 : t.EndsWith("ator") ? 2 : 1);
            };

            string[] testCases =
            {
                "Burninator-3000", "Burnator3000", "BurNinator 100", "BuRnInAtOr-7253",
                "burn", "burn-", "bUrn-1", "inator-7", "ator 56", "burninators 1000",
                "burn_1000", "BURNINATOR-9999", "burninator 99999", "burninator_99999",
                "Code Golfinator-3000", "inator ator hello world-1000", "javaiscool_99999",
                "hypen-ated", "1000", "-1000", "10000", "-10000"
            };

            foreach (string testCase in testCases)
            {
                Console.WriteLine($"{testCase} -> {f(testCase)}");
            }

            Console.ReadLine();
        }
    }
}

```

Splitting the regex off into it's own method is now 4 bytes longer (unless I missed something) due to only being allowed one lambda. This it comes in at 321 bytes:

```
namespace System.Linq{string m(string s,int n)=>Text.RegularExpressions.Regex.Match(s,"(.*?)([- ])?(\\d+)$").Groups[1].Value.ToLower();s=>{string t=m(s,1),c=m(s,2),n=m(s,3);return(s.Count(char.IsUpper)*1000+(n.Length>4|n==""?0: int.Parse(n))+(c==" "?1000:c=="-"?2000:0))*(t.EndsWith("inator")?3:t.EndsWith("ator")?2:1);}}

```

# Answer
> 2 votes
## Perl, 108 bytes

**107 bytes code + 1 for `-p`.**

```
$\+=1e3*y/A-Z//;s/( |-)?(\d+)$//;$\+=$2*($2<1e4);$\+={$",1e3,"-",2e3}->{$1};s/(in)?ator$//i&&($\*=$1?3:2)}{

```

Try it online!

# Answer
> 0 votes
# PHP\>=7.1, 165 bytes

```
preg_match("#((in)?ator)?((\D)?(\d+))?$#i",$argn,$m);[,$a,$i,,$c,$d]=$m;echo($d*($d<1e4)+(preg_match_all("#[A-Z]#",$argn)+($c!="-"?$c==" "?:0:2))*1e3)*($a?$i?3:2:1);

```

Testcases

---
Tags: code-golf, string
---


title: Create your original sequence challenge

text:
# Question
Title: Create your original sequence challenge
There are lots of challenges that just pick a sequence from oeis and ask you to print n-th number or first n numbers or whatever.

It's time to ~~stop~~ automate!

## Task

Your task is to parse a sequence page from oeis.org and print its index, description and example values. The page's index should be chosen and random, selected uniformly from the range `[1-289361]`.

Example outputs (formatted with newline as a separator):

```
A034434
Multiplicity of highest weight (or singular) vectors associated with character chi_46 of Monster module.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 7, 12, 21, 38, 60, 102, 165, 265, 416, 660, 1015, 1574, 2405, 3665, 5535, 8364, 12512, 18726, 27862, 41391, 61240, 90541, 133381, 196395, 288534, 423656, 621219, 910885, 1334634

A38246
Triangle whose (i,j)-th entry is binomial(i,j)*5^(i-j)*4^j.
1, 5, 4, 25, 40, 16, 125, 300, 240, 64, 625, 2000, 2400, 1280, 256, 3125, 12500, 20000, 16000, 6400, 1024, 15625, 75000, 150000, 160000, 96000, 30720, 4096, 78125, 437500, 1050000, 1400000, 1120000, 537600, 143360, 16384, 390625

A212813
Number of steps for n to reach 8 under iteration of the map i -> <a href="/A036288" title="a(n) = 1 + integer log of n: if the prime factorization of n is n = Product (p_j^k_j) then a(n) = 1 + Sum (p_j * k_j) (cf. A...">A036288</a>(i), or -1 if 8 is never reached.
-1, -1, -1, -1, -1, -1, 1, 0, 2, 1, 2, 1, 3, 2, 3, 3, 4, 3, 3, 2, 3, 3, 3, 2, 3, 4, 2, 2, 4, 3, 4, 3, 4, 3, 4, 3, 5, 4, 5, 2, 5, 4, 5, 4, 2, 5, 3, 2, 4, 4, 4, 4, 3, 2, 5, 3, 4, 4, 5, 4, 5, 4, 3, 4, 4, 5, 5, 4, 3, 4, 5, 4, 4, 3, 3, 3, 4, 4, 4, 3, 4, 5, 5, 4, 4, 6, 5, 4, 4, 3, 4, 3, 5, 5, 4, 3, 6, 5, 4, 4, 5, 4, 4, 3, 4, 4, 4, 3, 5, 4, 6, 4, 5, 4, 5, 4, 3, 5, 4

A155181
a(n)=5*a(n-1)+a(n-2), n>2 ; a(0)=1, a(1)=4, a(2)=20 .
1, 4, 20, 104, 540, 2804, 14560, 75604, 392580, 2038504, 10585100, 54964004, 285405120, 1481989604, 7695353140, 39958755304, 207489129660, 1077404403604, 5594511147680, 29049960142004, 150844311857700, 783271519430504

A227356
Partial sums of <a href="/A129361" title="a(n) = sum{k=floor((n+1)/2)..n, F(k+1)}.">A129361</a>.
1, 2, 5, 10, 20, 36, 65, 112, 193, 324, 544, 900, 1489, 2442, 4005, 6534, 10660, 17336, 28193, 45760, 74273, 120408, 195200, 316216, 512257, 829458, 1343077, 2174130, 3519412, 5696124, 9219105, 14919408, 24144289

```

Example, ungolfed, python script:

```
import requests
import random
seq = 'A%s' % `random.randint(1,289361)`.zfill(6)
page = requests.get('http://oeis.org/%s' % seq)
print_next = False
content = []
for line in page.text.split('\n'):
    if print_next:
        print_next = False
        content.append(line)
    if '<td width="710' in line or '<td valign=top align=left>' in line:
        print_next = True
print seq
print content[0].lstrip()
print content[1].lstrip()[4:-5]

```

## Rules

* oeis.org states, that there are **289361** sequences right now. You should not try to parse pages with higher index.
* Your program should **uniformly** choose a random page.
* Your program may produced undefined behavior if it randomly chooses to parse an oeis page that is reserved or does not contain a sequence (see A288145)
* Trailing white space is acceptable.
* You must remove leading white space and the outermost html tags from each line of your output. (i.e., the example values are wrapped in `<tt><tt/>`, which must be removed, but the description sometimes contains tags such as `<href>` within the text. Such tags do not need to be handled (see A195534)).
* You do not have to handle html escapes (see A219225)
* You do not need to print leading zeroes in the index. (e.g. A1 and A000001 are both acceptable). This is because oeis.org itself allows you to do either, as in, http://oeis.org/A1 and http://oeis.org/A000001 are both valid URLs that point to the same page.
* You may return/print the "lines" in one of the following formats:
    + As an array/list with three elements
    + As a string separated by some separator. However, the separator **must not appear** in any of the "lines" (the index, the description, or the example values). In addition, this separator must be consistent (you can't select a separator based on the content of the "lines").
* The meta definition of uniformly random applies.
* Standard loopholes apply.

This is , so shortest code (in bytes) wins.

# Answer
> 4 votes
## CJam (61 bytes)

```
"oeis.org/search?fmt=text&q=id:A"289361mr)s+gN%{1=s"ISN"&},N*

```

No online demo available because the use of `g` is restricted by both online testers for security reasons.

I'm still not convinced that the output format is clearly specified, but since I seem to be in a minority I'm exploiting its gaps for golfiness. There is no leading whitespace or outer HTML tag to remove in the output.

# Answer
> 2 votes
# Python 3, 198 bytes

```
from requests import*
import random,html
s='A%s'%str(random.randint(1,289355))
print(s)
t=get('http://oeis.org/%s'%s).text.split('\n')
print(html.unescape(t[95].strip()))
print(t[116].strip()[4:-5])

```

This works for everything I've tried so far, but since it hard-codes the line indices, please tell me if it breaks on anything (that isn't an unfilled reserved spot).

-9 bytes thanks to Dead Possum

---
Tags: code-golf, internet
---