cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A370892 Least positive integer k such that 4 numbers starting with k in an arithmetic progression with difference n have a solution in the game 24.

Original entry on oeis.org

3, 1, 1, 2, 1, 1, 1, 1, 2, 3, 2, 1, 1, 2, 2, 3, 2, 12, 9, 12, 2, 6, 2, 2, 12, 2, 2, 12, 4, 12, 5, 12, 4, 12, 12, 10, 12, 12, 12, 12, 8, 12, 12, 12, 2, 12, 2, 1, 8, 12, 2, 12, 12, 12, 12, 12, 12, 12, 12, 12, 8, 12, 12, 12, 12, 12, 12, 12, 12, 6, 5, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
Offset: 0

Views

Author

Colin Linzer, Mar 04 2024

Keywords

Comments

24 is a game in which, given 4 four numbers, you must find an expression that evaluates to 24 and contains each of those four numbers exactly once, no other numbers and only the operators of addition, subtraction, multiplication and division.
No term exceeds 12 as for any arithmetic progression 12, 12+n, 12+2n, 12+3n, there is the solution (12)+(12+n)+(12+2n)-(12+3n) = 24.
a(n) = 12 for all n > 144. - Robert Israel, Mar 06 2024

Examples

			For n=4, the arithmetic sequence 1, 5, 9, 13 has the solution (1+5)*(13-9) = 24 so a(4)=1.
		

Programs

  • Maple
    nv:= proc(V1,V2)
      local a1,a2;
      {seq(seq(op([a1+a2,a1*a2,a1-a2,a2-a1]),a1 = V1),a2 = V2),
           seq(seq(a1/a2,a1 = V1),a2=V2 minus {0}),
           seq(seq(a2/a1,a1 = V1 minus {0}),a2 = V2)}
    end proc:
    s24:= proc(a,b,c,d) local t;
      for t in combinat:-permute([a,b,c,d]) do
        if member(24, nv(nv(nv({t[1]},{t[2]}),{t[3]}),{t[4]})) then return true fi;
        if member(24, nv(nv({t[1]},{t[2]}),nv({t[3]},{t[4]}))) then return true fi;
      od;
      false
    end proc:
    f:= proc(n) local k;
      for k from 1 do
         if s24(k, k+n, k+2*n, k+3*n) then return k fi;
      od;
    end proc:
    map(f, [$0..100]); # Robert Israel, Mar 05 2024