OFFSET
0,1
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
LINKS
Colin Linzer, Java program for the sequence.
EXAMPLE
For n=4, the arithmetic sequence 1, 5, 9, 13 has the solution (1+5)*(13-9) = 24 so a(4)=1.
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
CROSSREFS
KEYWORD
nonn
AUTHOR
Colin Linzer, Mar 04 2024
STATUS
approved