Given n, can we find a triplet a, b, c that fits the following conditions:(adsbygoogle = window.adsbygoogle || []).push({});

n = a*b+c+5

abs(a-b+c) is minimum

but only if

n>a+b+abs(c)+5

Where n, a, b are naturals and c is integer.

For instance in case of n=65, I have a hunch the best choices are:

a = b = 8

c = 1

The background for this problem stems from an esoteric programming language - brainf*** ( http://en.wikipedia.org/wiki/brainf*** ). Specifically, I'm trying to find out the most efficient way of writing up ASCII text strings (numerical values between 32 and 255). You can do it either by using an n number of + signs (basically unary, where 65 would be represented by 65 times the '+' sign). The idea is that multiplying two numbers together would be a more efficient way. The code length would be exactly a+b+abs(c)+5.

Well, you don't have to get bogged down in the details of the language, but if you have an idea for an answer, algorithm or complexity analisys of the problem, you are most welcome to post it.

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# A weird little problem

Loading...

Similar Threads - weird little problem | Date |
---|---|

B Help me understand this weird patten in numbers | Sep 28, 2017 |

I How to motivate the study of Fermat's Little Theorem | Apr 23, 2017 |

B Weird tangent property | Nov 1, 2016 |

I Weird statement of conditions in propositional logic | Aug 30, 2016 |

I found a really weird function | May 2, 2015 |

**Physics Forums - The Fusion of Science and Community**