Skip to content

Instantly share code, notes, and snippets.

@shintakezou
Created November 5, 2016 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shintakezou/4b3f4a11bf830ffbd8a918ad133e196d to your computer and use it in GitHub Desktop.
Save shintakezou/4b3f4a11bf830ffbd8a918ad133e196d to your computer and use it in GitHub Desktop.
solve A problem with Susi 937 from Italian magazine "La Settimana Enigmistica"
-module(solve937).
-export([solve/0]).
% This solve the following problem:
% find that number X < 54, so X^2 = A + B,
% where A is the number made of the first
% 2 digits of X^2 and B is the number made
% of the last 2 digits of X^2.
check(X) ->
X2 = X * X,
A = X2 div 100,
B = X2 rem 100,
(A+B) == X.
solve() ->
L = [X || X <- lists:seq(32, 54),
check(X)],
io:fwrite("~w~n", [L]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment