Tuesday, October 8, 2013

Problem 48 - ELM

Problem 50 is drawing ever nearer, and with it, dreams of reaching level 2 and a nice round number. But I think I will like to use a familiar language to solve problem 50, but no super-familiar language was left open...so I decided to redo problem 48, which I recently did in C for the sake of expediency, but was simple enough that it only took a few minutes for me to write up a solution in ELM, which was freed up by my recent usage of INTERCAL. So, soon enough, problem 50 will be solved. When I solve problem 50, I will also switch over all of my files from dropbox to github; the repository is already made and the files are there, changing the links will be the only major hassle.
ans a i =
  if i > 1000 then a
  else (ans (mod ((subans i 1 i) + a) 10000000000) (i + 1))

subans a j i =
  if j == i then a
  else (subans (mod  (a * i) 10000000000) (j + 1) i)
  
main = asText (ans 0 1)

No comments:

Post a Comment