Hacker News new | past | comments | ask | show | jobs | submit login
2010 = 1+2-(3-4-5)*6*7*8-9 (thesamet.com)
92 points by edw519 on Jan 4, 2010 | hide | past | favorite | 35 comments



Similar idea, but with the first 8 primes:

2010 = 2 * 3 * 5 * (7+11+13+17+19)


Not sure if there's a typo there - by my calcs that = 15,745.

Edit: The formatting should give that away - an asterisk either side italicises the text.

2010 = 2 x 3 x 5 x (7+11+13+17+19)


Thanks. This was only my third comment on HN, so I guess I wasn't sure what to expect of the commenting system. It's my fault for not reviewing the post after submitting it though.


Now that I'm impressed with.


I can't take credit for it.

I saw this yesterday on Reddit: http://www.reddit.com/r/math/comments/akhp0/happy_2357111317...


Likely inspired by Knuth's Christmas Tree lecture: http://news.ycombinator.com/item?id=998655


I've found similar solutions for 192 of the years between 1900 and 2100.

Solutions:

http://pastie.org/765685

Ruby code (be forewarned, it is an offense against God):

http://pastie.org/765686


I've refined the program so that it isn't so much of an offense against all that is good and holy in programming practices. It is now only an offense against most programming practices. (cough Millions of executions of eval. cough 14 levels of nested for loops.)

The comments now explain what it is actually doing.

http://pastie.org/765992

The new and improved version of the program generates solutions for upwards of 2080 of the years between 0 and 2100, including everything from the last century except 1911.

It is also disgustingly parallel, and would make a good case study if you want to try your hand at a Map/Reduce or similar distributed approach. (That is the only feasible way to brute force this problem if you go up to 5 or 6 operators, unless you have a supercomputer handy. Even with only 4 operators it pegs JRuby for upwards of five minutes on my laptop, and the complexity is bounded by n^n where n is the number of operators.)


YEAH!

1.0-2.0x3.0+(4x(5+(6x(7+8x(9))))) = 1911 :D

Edit: So I have a program running now that is calculating them all in a cough extremely hack way. I'll post the code once I get all 200 of them between 1900 and 2100.


You have just made my day. I shudder to think what the search space for nested parentheses is like -- egads.


Lines 349 to 387 made me laugh. A little bit of recursion can hide a lot of deeply nested looping :)


I sincerely would like to see your recursive solution to this. Mine was not successful, so I ripped it out and went with the ugly approach that actually generated answers.


I'll see what I can whip up...


So where's the program that generated this?


I have no idea about the real program which generated this, but here is a piece of code that does something very similar: http://www.hoozi.com/post/r8kmz/programming-problems-arrangi...


They used AI for generating this..


Would you mind running it again with just 2-7 to get the answer to next week's puzzle challenge? ;-)

http://www.npr.org/templates/story/story.php?storyId=1221768...

"Write down the digits from 2 to 7, in order. Add two mathematical symbols to get an expression equaling 2010. What symbols are these?"


Answer, rot47ed so you don't read it by accident.

p55 2 Y 27E6C E96 d 2?5 2 ^ 27E6C E96 e] abcdYe^f l a_`_


Thanks for the reply...and giving me a reason to learn about rot algorithms.


Points for the first person who can demonstrate this is possible for ever year from 1900 to 2100.


We did it all for the points - 3pt14159 & BenjaminCoe

((1.0x2.0)+3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))-9.0) = 1900

((1.0+2.0)+3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))-9.0) = 1901

((1.0-2.0)-3.0)x(((4.0-(5.0/6.0))-(7.0x8.0))x9.0) = 1902

(1.0+(2.0x3.0))-(4.0x((5.0x6.0)-((7.0x8.0)x9.0))) = 1903

((1.0+2.0)x3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))-9.0) = 1904

((1.0+(2.0+3.0))x(4.0x5.0))x(6.0+((7.0/8.0)+9.0)) = 1905

(1.0x2.0)x(((3.0x4.0)+5.0)+(((6.0+7.0)x8.0)x9.0)) = 1906

((1.0x((2.0+3.0)+4.0))x((5.0x6.0)x7.0))+(8.0+9.0) = 1907

((1.0-2.0)-3.0)x(((4.0+(5.0-6.0))-(7.0x8.0))x9.0) = 1908

((1.0-2.0)-3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))+9.0) = 1909

((1.0-2.0)x3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))+9.0) = 1910

(1.0+2.0)x(((3.0x4.0)+((5.0+6.0)x(7.0x8.0)))+9.0) = 1911

((1.0x2.0)-3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))+9.0) = 1912

((1.0+2.0)-3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))+9.0) = 1913

((1.0+2.0)/3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))+9.0) = 1914

((1.0-2.0)+3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))+9.0) = 1915

1.0x(2.0x((3.0x4.0)x(((5.0/6.0)+7.0)+(8.0x9.0)))) = 1916

((1.0/(2.0+3.0))+((4.0x5.0)-6.0))x((7.0+8.0)x9.0) = 1917

((1.0x2.0)+3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))+9.0) = 1918

((1.0+2.0)+3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))+9.0) = 1919

(((1.0x(2.0/(3.0/4.0)))x5.0)x6.0)x((7.0+8.0)+9.0) = 1920

((1.0-2.0)x(3.0-(4.0x5.0)))x(((6.0+7.0)x8.0)+9.0) = 1921

((1.0+2.0)x3.0)+(((4.0+(5.0x6.0))x(7.0x8.0))+9.0) = 1922

(((1.0x2.0)+(3.0/(4.0/5.0)))x(6.0x(7.0x8.0)))-9.0 = 1923

((1.0+((2.0x3.0)x4.0))x((5.0+6.0)x7.0))+(8.0-9.0) = 1924

(1.0-2.0)+((((3.0x4.0)+(5.0x(6.0x7.0)))-8.0)x9.0) = 1925

(1.0+(2.0+(((3.0/4.0)+5.0)x((6.0x7.0)x8.0))))-9.0 = 1926

((1.0-2.0)+(((3.0x4.0)-5.0)x6.0))x((7.0x8.0)-9.0) = 1927

(1.0x2.0)+((((3.0x4.0)+(5.0x(6.0x7.0)))-8.0)x9.0) = 1928

(1.0+2.0)+((((3.0x4.0)+(5.0x(6.0x7.0)))-8.0)x9.0) = 1929

((1.0+2.0)+(3.0+4.0))x((5.0x(6.0x7.0))-(8.0+9.0)) = 1930

((1.0x2.0)x((3.0+(4.0x5.0))x(6.0x7.0)))+(8.0-9.0) = 1931

((1.0x2.0)+(3.0x4.0))x((5.0x(6.0x7.0))-(8.0x9.0)) = 1932

1.0+((((2.0/3.0)-4.0)+((5.0x(6.0x7.0))+8.0))x9.0) = 1933

((1.0+2.0)x3.0)x((4.0+(5.0x(6.0x7.0)))+(8.0/9.0)) = 1934

((1.0x2.0)+3.0)x(((4.0x(5.0+6.0))+(7.0-8.0))x9.0) = 1935

(1.0+(((2.0x3.0)x4.0)x5.0))x((6.0-7.0)+(8.0+9.0)) = 1936

((1.0-2.0)-(3.0x4.0))+((5.0x6.0)x((7.0x8.0)+9.0)) = 1937

(1.0+(2.0x((3.0+4.0)/5.0)))x(6.0+(7.0x(8.0x9.0))) = 1938

1.0-((2.0x3.0)-((4.0+((5.0x6.0)-7.0))x(8.0x9.0))) = 1939

1.0-((2.0+3.0)-((4.0+((5.0x6.0)-7.0))x(8.0x9.0))) = 1940

(((1.0x2.0)+(3.0/(4.0/5.0)))x(6.0x(7.0x8.0)))+9.0 = 1941

((1.0+((2.0x3.0)x4.0))x((5.0+6.0)x7.0))+(8.0+9.0) = 1942

1.0x((2.0-3.0)+((4.0+((5.0x6.0)-7.0))x(8.0x9.0))) = 1943

((1.0+2.0)x3.0)x(((4.0+(5.0+6.0))x(7.0+8.0))-9.0) = 1944

1.0-((2.0-3.0)x((4.0+((5.0x6.0)-7.0))x(8.0x9.0))) = 1945

1.0-((2.0-3.0)-((4.0+((5.0x6.0)-7.0))x(8.0x9.0))) = 1946

(1.0-(2.0x((3.0x4.0)+5.0)))x(6.0+(7.0-(8.0x9.0))) = 1947

((1.0-2.0)+3.0)-(4.0-((5.0x6.0)x((7.0x8.0)+9.0))) = 1948

1.0x((2.0+3.0)+((4.0+((5.0x6.0)-7.0))x(8.0x9.0))) = 1949

1.0+((2.0+3.0)+((4.0+((5.0x6.0)-7.0))x(8.0x9.0))) = 1950

1.0+((2.0x3.0)+((4.0+((5.0x6.0)-7.0))x(8.0x9.0))) = 1951

(1.0x2.0)+((((3.0-4.0)x5.0)x6.0)x(7.0-(8.0x9.0))) = 1952

(((1.0/2.0)x((3.0/4.0)-5.0))+6.0)x(7.0x(8.0x9.0)) = 1953

(1.0-((2.0+3.0)+4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1954

(1.0x2.0)+((((3.0-4.0)+(5.0x(6.0x7.0)))+8.0)x9.0) = 1955

(1.0+2.0)+((((3.0-4.0)+(5.0x(6.0x7.0)))+8.0)x9.0) = 1956

(1.0x((2.0-3.0)-4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1957

(1.0/((2.0-3.0)/4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1958

(1.0+((2.0-3.0)x4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1959

((1.0+(2.0x3.0))x(4.0x5.0))x((6.0+7.0)-(8.0-9.0)) = 1960

(1.0-2.0)-((((3.0-4.0)x(5.0x(6.0x7.0)))-8.0)x9.0) = 1961

((1.0x2.0)/(3.0/(4.0+5.0)))x(((6.0x7.0)x8.0)-9.0) = 1962

(1.0/((2.0+3.0)-4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1963

(1.0x2.0)-((((3.0-4.0)x(5.0x(6.0x7.0)))-8.0)x9.0) = 1964

(1.0+2.0)-((((3.0-4.0)x(5.0x(6.0x7.0)))-8.0)x9.0) = 1965

(1.0+((2.0-3.0)+4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1966

((((1.0+(2.0+3.0))x4.0)-5.0)x((6.0+7.0)x8.0))-9.0 = 1967

1.0x((2.0/3.0)x((4.0+((5.0x6.0)+7.0))x(8.0x9.0))) = 1968

1.0+((2.0/3.0)x((4.0+((5.0x6.0)+7.0))x(8.0x9.0))) = 1969

(1.0-2.0)-((((3.0-4.0)-(5.0x(6.0x7.0)))-8.0)x9.0) = 1970

((((1.0+2.0)x3.0)x4.0)x((5.0-6.0)+(7.0x8.0)))-9.0 = 1971

(1.0+((2.0+3.0)+4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1972

(1.0x2.0)-((((3.0-4.0)-(5.0x(6.0x7.0)))-8.0)x9.0) = 1973

(((1.0+(2.0+(3.0-4.0)))+5.0)x6.0)x((7.0x8.0)-9.0) = 1974

(((1.0x2.0)+((3.0x4.0)+5.0))+6.0)x(7.0+(8.0x9.0)) = 1975

1.0-((2.0+3.0)-(4.0x(((5.0-6.0)+(7.0x8.0))x9.0))) = 1976

((1.0x2.0)+3.0)-(4.0x((5.0+6.0)-((7.0x8.0)x9.0))) = 1977

(1.0+(((2.0+3.0)+4.0)x5.0))x((6.0x7.0)-(8.0-9.0)) = 1978

1.0x((2.0-3.0)+(4.0x(((5.0-6.0)+(7.0x8.0))x9.0))) = 1979

((((1.0+2.0)-3.0)+4.0)x((5.0-6.0)+(7.0x8.0)))x9.0 = 1980

1.0-(((((2.0+3.0)x4.0)x(5.0+6.0))/(7.0-8.0))x9.0) = 1981

(1.0x((2.0+3.0)x4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1982

(1.0+((2.0+3.0)x4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1983

(1.0-(2.0x3.0))+(((4.0+5.0)x(6.0+7.0))x(8.0+9.0)) = 1984

((((1.0+(2.0+3.0))x4.0)-5.0)x((6.0+7.0)x8.0))+9.0 = 1985

((((1.0+2.0)-3.0)-4.0)x((5.0/6.0)-(7.0x8.0)))x9.0 = 1986

(1.0+((2.0x3.0)x4.0))+(((5.0x(6.0x7.0))+8.0)x9.0) = 1987

1.0-((2.0-3.0)+(4.0x(((5.0/6.0)-(7.0x8.0))x9.0))) = 1988

((((1.0+2.0)x3.0)x4.0)x((5.0-6.0)+(7.0x8.0)))+9.0 = 1989

1.0+(((((2.0+3.0)x4.0)x(5.0+6.0))-(7.0-8.0))x9.0) = 1990

((((1.0-(2.0-3.0))x4.0)x5.0)x((6.0x7.0)+8.0))-9.0 = 1991

(1.0+(2.0-((3.0x4.0)-5.0)))x(6.0-(7.0x(8.0x9.0))) = 1992

1.0+((2.0x3.0)-(4.0x(((5.0/6.0)-(7.0x8.0))x9.0))) = 1993

(1.0x(2.0+3.0))+(((4.0+5.0)x(6.0+7.0))x(8.0+9.0)) = 1994

((1.0/2.0)x(3.0+4.0))x(5.0x((6.0x7.0)+(8.0x9.0))) = 1995

(1.0-(2.0+3.0))x(((4.0-5.0)+6.0)-((7.0x8.0)x9.0)) = 1996

(1.0-2.0)-((((3.0/4.0)x(5.0-(6.0x7.0)))x8.0)x9.0) = 1997

((1.0-2.0)x(3.0/4.0))x((5.0-(6.0x7.0))x(8.0x9.0)) = 1998

1.0-((((2.0-3.0)x4.0)-((5.0x(6.0x7.0))+8.0))x9.0) = 1999

(1.0-(2.0-((3.0x4.0)+5.0)))x(6.0+(7.0x(8.0+9.0))) = 2000

(1.0+2.0)-((((3.0/4.0)x(5.0-(6.0x7.0)))x8.0)x9.0) = 2001

((1.0/((2.0+3.0)/4.0))+(5.0x6.0))x((7.0x8.0)+9.0) = 2002

((1.0x2.0)+3.0)+((4.0+((5.0x(6.0x7.0))+8.0))x9.0) = 2003

((1.0x((2.0+3.0)x4.0))+((5.0/6.0)+7.0))x(8.0x9.0) = 2004

1.0+((((2.0/3.0)+4.0)+((5.0x(6.0x7.0))+8.0))x9.0) = 2005

(1.0-(2.0+(((3.0-4.0)-5.0)x((6.0x7.0)x8.0))))-9.0 = 2006

(((1.0x2.0)/(3.0/(4.0+5.0)))x(6.0x(7.0x8.0)))-9.0 = 2007

1.0-((((2.0-3.0)-4.0)-((5.0x(6.0x7.0))+8.0))x9.0) = 2008

((((1.0-(2.0-3.0))x4.0)x5.0)x((6.0x7.0)+8.0))+9.0 = 2009

(1.0+(2.0-(((3.0-4.0)-5.0)x((6.0x7.0)x8.0))))-9.0 = 2010

1.0-((2.0x3.0)+((4.0x((5.0-6.0)x7.0))x(8.0x9.0))) = 2011

((1.0-2.0)-3.0)-(((4.0/(5.0-6.0))x(7.0x8.0))x9.0) = 2012

((1.0-2.0)x3.0)-(((4.0/(5.0-6.0))x(7.0x8.0))x9.0) = 2013

((1.0-2.0)+3.0)+(4.0x((5.0-6.0)+((7.0x8.0)x9.0))) = 2014

((1.0x2.0)-3.0)-(((4.0/(5.0-6.0))x(7.0x8.0))x9.0) = 2015

((1.0+2.0)-3.0)-(((4.0/(5.0-6.0))x(7.0x8.0))x9.0) = 2016

((1.0+2.0)/3.0)-(((4.0/(5.0-6.0))x(7.0x8.0))x9.0) = 2017

((1.0-2.0)+3.0)-(((4.0/(5.0-6.0))x(7.0x8.0))x9.0) = 2018

(1.0+2.0)-((((3.0+4.0)-5.0)-6.0)x(7.0x(8.0x9.0))) = 2019

(1.0-(2.0x3.0))+(((4.0+5.0)+6.0)x((7.0+8.0)x9.0)) = 2020

((1.0x2.0)+3.0)-(((4.0/(5.0-6.0))x(7.0x8.0))x9.0) = 2021

((1.0+2.0)+3.0)-(((4.0/(5.0-6.0))x(7.0x8.0))x9.0) = 2022

1.0+((2.0x3.0)-((4.0x((5.0-6.0)x7.0))x(8.0x9.0))) = 2023

((1.0x2.0)-3.0)+(((4.0+(5.0+6.0))x(7.0+8.0))x9.0) = 2024

((1.0-2.0)+3.0)/(((4.0/(5.0x6.0))/(7.0+8.0))/9.0) = 2025

((1.0+2.0)/3.0)+(((4.0+(5.0+6.0))x(7.0+8.0))x9.0) = 2026

((1.0-2.0)+3.0)+(((4.0+(5.0+6.0))x(7.0+8.0))x9.0) = 2027

(1.0+2.0)+((((3.0+4.0)+(5.0x(6.0x7.0)))+8.0)x9.0) = 2028

(1.0-((2.0-(3.0x4.0))x((5.0x6.0)x7.0)))-(8.0x9.0) = 2029

((1.0x2.0)+3.0)+(((4.0+(5.0+6.0))x(7.0+8.0))x9.0) = 2030

((1.0+2.0)+3.0)+(((4.0+(5.0+6.0))x(7.0+8.0))x9.0) = 2031

(1.0+(2.0x3.0))+(((4.0+5.0)+6.0)x((7.0+8.0)x9.0)) = 2032

(1.0x(2.0+(((3.0x4.0)x5.0)x((6.0x7.0)-8.0))))-9.0 = 2033

((1.0+2.0)x3.0)+(((4.0+(5.0+6.0))x(7.0+8.0))x9.0) = 2034

1.0+((((2.0x3.0)x4.0)+((5.0x(6.0x7.0))-8.0))x9.0) = 2035

((1.0-2.0)-3.0)x(4.0-(((5.0x(6.0+7.0))-8.0)x9.0)) = 2036

((((1.0+2.0)x3.0)x4.0)x((5.0/6.0)+(7.0x8.0)))-9.0 = 2037

(1.0-((2.0-((3.0+4.0)x5.0))x(6.0+(7.0x8.0))))-9.0 = 2038

(1.0-2.0)+((3.0-(4.0-5.0))x(6.0+(7.0x(8.0x9.0)))) = 2039

1.0x((2.0+3.0)x((4.0x((5.0-6.0)+7.0))x(8.0+9.0))) = 2040

1.0+((2.0+3.0)x((4.0x((5.0-6.0)+7.0))x(8.0+9.0))) = 2041

1.0-((2.0+3.0)-(4.0x(((5.0/6.0)+(7.0x8.0))x9.0))) = 2042

((1.0x2.0)+(3.0+4.0))x((5.0x(6.0x7.0))+(8.0+9.0)) = 2043

(1.0-(((2.0x3.0)x4.0)+5.0))x((6.0-7.0)-(8.0x9.0)) = 2044

1.0x((2.0-3.0)+(4.0x(((5.0/6.0)+(7.0x8.0))x9.0))) = 2045

((((1.0+2.0)-3.0)+4.0)x((5.0/6.0)+(7.0x8.0)))x9.0 = 2046

1.0-((2.0x3.0)+(4.0x(((5.0-6.0)-(7.0x8.0))x9.0))) = 2047

(1.0-(2.0-(((3.0x4.0)x5.0)x((6.0x7.0)-8.0))))+9.0 = 2048

(1.0-(2.0x3.0))+(((4.0x5.0)+6.0)x(7.0+(8.0x9.0))) = 2049

(1.0x(((2.0x3.0)+4.0)x5.0))x((6.0x7.0)+(8.0-9.0)) = 2050

(1.0x(2.0+(((3.0x4.0)x5.0)x((6.0x7.0)-8.0))))+9.0 = 2051

((((1.0+2.0)-3.0)-4.0)x((5.0-6.0)-(7.0x8.0)))x9.0 = 2052

1.0+((2.0x3.0)+(4.0x(((5.0/6.0)+(7.0x8.0))x9.0))) = 2053

(((1.0+2.0)/((3.0/4.0)/5.0))+6.0)x(7.0+(8.0x9.0)) = 2054

((((1.0+2.0)+3.0)x4.0)x((5.0x6.0)+(7.0x8.0)))-9.0 = 2055

((1.0-2.0)-3.0)+(4.0x((5.0+6.0)+((7.0x8.0)x9.0))) = 2056

1.0x((2.0+3.0)-(4.0x(((5.0-6.0)-(7.0x8.0))x9.0))) = 2057

(1.0-(((2.0x3.0)+4.0)x5.0))x((6.0x7.0)/(8.0-9.0)) = 2058

(1.0x(((2.0x3.0)x4.0)+5.0))x((6.0-7.0)+(8.0x9.0)) = 2059

((1.0+2.0)-3.0)+(4.0x((5.0+6.0)+((7.0x8.0)x9.0))) = 2060

((1.0+(2.0+3.0))x((4.0+5.0)+((6.0x7.0)x8.0)))-9.0 = 2061

(1.0-2.0)-((((3.0+4.0)x(5.0-(6.0x7.0)))x8.0)+9.0) = 2062

(1.0-2.0)x((((3.0+4.0)x(5.0-(6.0x7.0)))x8.0)+9.0) = 2063

((((1.0x2.0)/3.0)x4.0)x((5.0x6.0)+(7.0x8.0)))x9.0 = 2064

((1.0-2.0)x(3.0+4.0))x(5.0x((6.0+7.0)-(8.0x9.0))) = 2065

(1.0+2.0)-((((3.0+4.0)x(5.0-(6.0x7.0)))x8.0)+9.0) = 2066

(1.0x2.0)+(((3.0+4.0)x5.0)x(((6.0x7.0)+8.0)+9.0)) = 2067

(((1.0+(2.0+(3.0+4.0)))x5.0)-6.0)x((7.0x8.0)-9.0) = 2068

(1.0-2.0)+((((3.0x4.0)+(5.0x(6.0x7.0)))+8.0)x9.0) = 2069

1.0x((2.0+3.0)/((4.0/((5.0x6.0)-7.0))/(8.0x9.0))) = 2070

1.0+((2.0+3.0)/((4.0/((5.0x6.0)-7.0))/(8.0x9.0))) = 2071

(1.0x2.0)+((((3.0x4.0)+(5.0x(6.0x7.0)))+8.0)x9.0) = 2072

((((1.0+2.0)+3.0)x4.0)x((5.0x6.0)+(7.0x8.0)))+9.0 = 2073

((1.0+2.0)+3.0)+(4.0x((5.0+6.0)x((7.0x8.0)-9.0))) = 2074

1.0+((2.0x3.0)+((4.0x(5.0+6.0))x((7.0x8.0)-9.0))) = 2075

((1.0+((2.0+3.0)x4.0))+((5.0/6.0)+7.0))x(8.0x9.0) = 2076

((1.0+(2.0+3.0))+((4.0x5.0)x((6.0+7.0)x8.0)))-9.0 = 2077

((1.0+(2.0x3.0))+((4.0x5.0)x((6.0+7.0)x8.0)))-9.0 = 2078

((1.0/2.0)x3.0)/(((4.0/(5.0+6.0))/(7.0x8.0))/9.0) = 2079

1.0+((2.0x3.0)x((4.0x((5.0+6.0)x7.0))/(8.0/9.0))) = 2080

(1.0-2.0)x((((3.0+4.0)x(5.0-(6.0x7.0)))x8.0)-9.0) = 2081

(1.0x2.0)x(((3.0x4.0)x((5.0x6.0)+(7.0x8.0)))+9.0) = 2082

(1.0x2.0)-((((3.0+4.0)x(5.0-(6.0x7.0)))x8.0)-9.0) = 2083

(1.0+2.0)-((((3.0+4.0)x(5.0-(6.0x7.0)))x8.0)-9.0) = 2084

((1.0-(2.0+3.0))+((4.0x5.0)x((6.0+7.0)x8.0)))+9.0 = 2085

1.0x(2.0x((3.0+4.0)x(((5.0+6.0)x7.0)+(8.0x9.0)))) = 2086

(1.0-2.0)+((((3.0+4.0)x(5.0-(6.0/7.0)))x8.0)x9.0) = 2087

((((1.0-2.0)+3.0)x4.0)x((5.0x6.0)+(7.0-8.0)))x9.0 = 2088

((((1.0+(2.0-3.0))+4.0)x5.0)x((6.0+7.0)x8.0))+9.0 = 2089

((1.0+2.0)+(3.0+4.0))x((5.0x(6.0x7.0))+(8.0-9.0)) = 2090

((((1.0x2.0)/3.0)+4.0)x((5.0x6.0)x(7.0+8.0)))-9.0 = 2091

1.0+(((((2.0/3.0)+4.0)x(5.0x6.0))x(7.0+8.0))-9.0) = 2092

((1.0/2.0)-(3.0+4.0))x((5.0-(6.0x(7.0x8.0)))+9.0) = 2093

((1.0x(2.0+3.0))+((4.0x5.0)x((6.0+7.0)x8.0)))+9.0 = 2094

((1.0/2.0)-(((3.0+4.0)x5.0)x6.0))x((7.0-8.0)-9.0) = 2095

((1.0+(2.0x3.0))+((4.0x5.0)x((6.0+7.0)x8.0)))+9.0 = 2096

((((1.0-2.0)+3.0)x4.0)x((5.0x6.0)-(7.0/8.0)))x9.0 = 2097

((1.0+2.0)+((3.0+((4.0x5.0)x(6.0+7.0)))x8.0))-9.0 = 2098

(1.0-2.0)-((((3.0+4.0)x5.0)x6.0)x(7.0-(8.0+9.0))) = 2099

((1.0x2.0)-(3.0x4.0))x((5.0x(6.0x7.0))/(8.0-9.0)) = 2100


great job but... (1.0-2.0)+((((3.0+4.0)x(5.0-(6.0/7.0)))x8.0)x9.0) != 2087


actually...(1.0-2.0)+((((3.0+4.0)x(5.0-(6.0/7.0)))x8.0)x9.0) == 2087


I wonder how many numbers between 0 and 9! (if any) cannot be generated by each method.


Actually, not 9! but (1+2) x 3 x ... x 9, because multiplying by 1 is no use.

According to my brute-forcer, you can get everything from 0 to 2283 but not 2284. The first few missing numbers are 2284, 2758, 2812, 2902, 2932, 3076, 3119, 3137, 3208. The first gap of more than one number is that you can't do either 3802 or 3803. The first gap of >= 3 numbers is 4280-4282. The total number of different achievable nonnegative integers is 14026. The biggest two are 9! and (3/2)x9!, unsurprisingly.


I regret that my program doesn't record how it achieved each number, so without running it again I can't tell you how to get 2036 or 2086 as per 3pt14159's request above.

It's at http://pastie.org/767276 in case anyone cares.


Based on my limited knowledge of positional number systems, I would think it's possible for any integer from 1 to some upper bound.


111111102 is probably the upper bound.


If you're going to allow "multiple digits", 123456789 is greater than 111111102 (12345678*9).


True, but it's like saying 2010 = 2010.


"Upper bound" has a very specific meaning.


I'm still missing 2036 and 2086, but besides that I have the rest of them. I will get those points sooner or later!


I would be shocked if it weren't, based on the sheer number of possibilities for this one year.


That's like saying there can't be any prime numbers, because there are so many ways you can factor 2010.


Yes, it's cool.




Applications are open for YC Winter 2024

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: