RosettaCodeData/Task/Babbage-problem/Befunge/babbage-problem.bf

19 lines
670 B
Brainfuck

1+ ::* "d"::** % "V8":** -! #v_ > > > > >
v
increment n n*n modulo 1000000 equal to 269696? v if false, loop to right
v
v"Smallest number whose square ends in 269696 is "0 < else output n below
>:#,_$ . 55+, @
ouput message then n newline exit
numeric constants explained:
"d" ascii value of 'd', i.e. 100
:: duplicate twice: 100,100,100
** multiply twice: 100*100*100 = 1000000
"V8" ascii values of 'V' and '8', i.e. 86 and 56
: duplicate the '8' (56): 86,56,56
** multiply twice: 86*56*56 = 269696