text:
How NOT to reduce fractions
Reducing fractions the wrong way
In this code-golf challenge you have to find fractions that can be reduced the wrong way but still end up in the same number.
Note: reducing fractions the wrong way does here have an exact definition, see details.
Example:
64/16 = 64/16=4/1 = 4
Of course you cannot just strike both 6es but here you still end up with the correct value. In this challenge you have to find examples like this.
Details
You have to write a function/program that accepts one positive integer n as input and outputs/returns a list/array of the fractions in format
numerator1,denominator1,numerator2,denominator2,...
The program has to find out for each fraction a/b with a+b=n and a,b>0 whether it can be reduced the wrong way. (It does not matter whether if it can be reduced in the conventional way or whether there are many possibilities of reductions, it just has to be possible to reduce it the wrong way in at least one way.)
Definition of the wrong way: A fraction can be reduced the wrong way if and only if the same sequence of successive digits appears in a and b and if the value of the fraction stays the same if you remove the substring.
Example: 1536/353 can be 'reduced' to 16/3 but those two values are not equal so you cannot reduce this fraction the wrong way.
Note that this definition of reducing the wrong way can also include fractions that are reduced the right way: 110/10 = 11/1 is within the definition of reducing the wrong way even though it is a valid step.
Scoring
The least number of bytes wins. You can write a function or program that accepts an integer and returns an array or a program that uses stdin/stdout or you can consider n saved in a variable and in the end of the program the list must be saved in an other variable.
Test cases
Please include following testcases (Tell me which ones I should add, I have no idea how many of those fractions there are / how many examples to expect)
n=80 (64/16 should be in this list)
n=147 (98/49 should be in this list)
n=500 (294/196 should be in this list) WRONG since 294+196 != 500 Thanks Falko

I'm guessing a and b are constrained to positive integers?

Or if we had two negative numbers, crossing out the '-' would be another great way to reduce the right and wrong way.

Consider defining a term for "the wrong way", such as "goofy" or "freaky". I think the post would be easier to understand, because readers immediately grok that there must be a definition for the term.

What if there are multiple ways to reduce a fraction and only some of them are wrong? 1010/10 = 101/1 && 1010/10 /= 110/1

Variant of https://projecteuler.net/problem=33 ?

@ JanDvorak you just have to determine whether a fraction can be reduced the wrong way. @ MichaelEaster: Ok I will think abou this. (Thats why I wrote it in italic but perhaps that is not enough.) @ user80551: I did not remember this problem, I just got this example from my algebra teacher=)

Your second test case (n=147) is incorrect: 49/89 != 4/8.

If there's more than one way to reduce a fraction, may we include it multiple times in the result set?

does it matter if the digits are not in the same order in the numerator and denominator, or if the digits aren't close together? you used the word 'sequence' when defining "reducing the wrong way" which implies that it does matter, but to me it doesn;t seem to be less "reducing the wrong way".

@proudhaskeller If in doubt, follow the definition rather than intuition. That's what definitions are for. I have followed the definition in my answer.

@proudhaskeller You could of cours make different definitions but you guessed correctly: according to mine the order matters!

Am I wrong or is your third test case invalid, since 500!=294+196?

@Wrzlprmft Yes. @ Falko: you aren't wrowng, this is a mistake. (I think Beta Decay added this one).

@flawr: You seem to have missed Jan Dvorak’s question regarding your challenge.

Python 2 – 183 180
r=range
s=lambda a:[(a[i:j],int(a[:i]+a[j:]))for i in r(len(a))for j in r(i+1,len(a)+(i>0))]
l=sum([[a,n-a]for a in r(n)for p,x in s(`a`)for q,y in s(`n-a`)if(n-a)*x==a*y<p==q],[])

the input must be stored in n, the output will be stored in l.
Test cases:
n = 80:
[10, 70, 16, 64, 20, 60, 30, 50, 40, 40, 40, 40, 50, 30, 60, 20, 64, 16, 70, 10]

n = 147:
[49, 98, 98, 49]

n =490:
[10, 480, 20, 470, 30, 460, 40, 450, 50, 440, 60, 430, 70, 420, 80, 410, 90, 400, 90, 400, 98, 392, 100, 390, 100, 390, 110, 380, 120, 370, 130, 360, 140, 350, 150, 340, 160, 330, 170, 320, 180, 310, 190, 300, 190, 300, 196, 294, 200, 290, 200, 290, 210, 280, 220, 270, 230, 260, 240, 250, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 250, 240, 260, 230, 270, 220, 280, 210, 290, 200, 290, 200, 294, 196, 300, 190, 300, 190, 310, 180, 320, 170, 330, 160, 340, 150, 350, 140, 360, 130, 370, 120, 380, 110, 390, 100, 390, 100, 392, 98, 400, 90, 400, 90, 410, 80, 420, 70, 430, 60, 440, 50, 450, 40, 460, 30, 470, 20, 480, 10]

Should duplicates in the output be forbidden, it gets 10 characters longer:
r=range
s=lambda a:[(a[i:j],int(a[:i]+a[j:]))for i in r(len(a))for j in r(i+1,len(a)+(i>0))]
l=sum(map(list,{(a,n-a)for a in r(n)for p,x in s(`a`)for q,y in s(`n-a`)if(n-a)*x==a*y<p==q}),[])

Haskell, 207 206 (209?) characters
import Data.List
x![]=[x];(w:x)!(y:z)|w==y=x!z;_!_=[]
a@(w:x)%b=a!b++[w:e|e<-x%b];a%b=a!b
h=show
f n=[(c,n-c)|c<-[1..n-1],i<-inits$h c,s<-init$tails i,s/=h c,a<-h c%s,b<-h(n-c)%s,read a*(n-c)==read('0':b)*c]

If it's not allowable to return the same ratio more than once (400/400 = 40/40 = 4/4), use f n=nub[... to filter them out.
Returns a list of pairs. A list of two-element pairs costs the same. A list of actual fractions would require importing Data.Ratio or fully qualifying Data.Ratio.% (which also collides with the % function defined here)
test cases (with nub):
Prelude Data.List> f 80
[(10,70),(16,64),(20,60),(30,50),(40,40),(50,30),(60,20),(64,16),(70,10)]
Prelude Data.List> f 147
[(49,98),(98,49)]
Prelude Data.List> f 500
[(10,490),(20,480),(30,470),(40,460),(50,450),(60,440),(70,430),(80,420),(90,410
),(100,400),(110,390),(120,380),(130,370),(140,360),(150,350),(160,340),(170,330
),(180,320),(190,310),(200,300),(210,290),(220,280),(230,270),(240,260),(250,250
),(260,240),(270,230),(280,220),(290,210),(300,200),(310,190),(320,180),(330,170
),(340,160),(350,150),(360,140),(370,130),(380,120),(390,110),(400,100),(410,90)
,(420,80),(430,70),(440,60),(450,50),(460,40),(470,30),(480,20),(490,10)]

ungolfed and commented:
import Data.List

-- haystack ! needle - the haystack with the needle removed, wrapped in a single-element list
--                       or an empty array if the haystack does not start with the needle

x ! [] = [x]                        -- case: empty needle = match with the full haystack left
(h:hs) ! (n:ns) | h == n = hs ! ns  -- case: needle and haystack match
_ ! _ = []                          -- case: no match

-- haystack % needle - the haystack with the needle removed
--                       for all positions of the needle in the haystack

a@(h:hs) % b = a ! b ++ map (h:) (hs%b) -- either remove the needle here, or elsewhere
a % b = a                               -- empty haystack cannot be popped

-- f - the function we are interested in

f total = [ (num, total - num)
          | num   <- [1 .. total-1],            -- for each numerator in range
            i     <- inits $ show num,          -- for each postfix of the numerator
            sub   <- init $ tails i,            -- for each prefix of the postfix except the last (empty) one
            sub /= show num,                    -- that isn't equal to the numerator
            reNum <- show num % sub,            -- remove the substring from the numerator
            reDiv <- show (total - num) % sub,  -- as well as from the denominator.

                                                -- the resulting ratios must be equal by value:
            (read reNum) ^ (total - num) == (read '0':reDiv) * num]

can you change ';' to newlines (in the golfed code)? it doesn't change the byte count and it makes the code much more readable

@proudhaskeller That's deliberate; I like having fewer lines in the golfed code. Also, the line lengths are more balanced this way. Do you think I should change?

do whatever you want, but i would like the lines to be spread out so i would be able to read the code better (rather then resorting to the ungolfed code)

Are you fine with the current version? I can't split the last line, unfortunately (except at spaces, which would kill readability)

as I said, do whatever you feel like

won't this not allow reducing digits which aren't the same order in the numerator and the denominator, or which aren't close together?

That's the desired behavior; "iff the same sequence of digits appears in a and b and ..."

I don't see what makes these less of reducing fractions the wrong way. i'll ask the person who wrote the question.

@proudhaskeller removing more than one subsequence at the same time results in a reduction that doesn't follow the definition in the question.

by the way, you could golf it by removing the requirement sub/=[] and instead adding replacing tails i with tail$tails i

@proudhaskeller thanks, implemented (except the empty one is the last one, not the first one)

Python 3 - 302
Note: Due to parsing difficulties, there are no fractions with the number 0 in (so no fractions are calculated using the correct method).
n=int(input());s=str;r=range
print([[a,b]for a in r(1,n)for b in r(1,a)for i in r(1,n)if i!=a and i!=b and s(i)in s(a)and s(i)in s(b)and s(a).count(s(i))<len(s(a))and s(b).count(s(i))<len(s(b))and not'0'in s(a)and not'0'in s(b)and eval(s(a).replace(s(i),'')+'/'+s(b).replace(s(i),''))==a/b and a+b<=n])

With n=80:
[[64, 16]]

With n=147
[[64, 16], [65, 26], [95, 19], [98, 49]]

With n=500
[[64, 16], [65, 26], [95, 19], [98, 49], [136, 34], [192, 96], [194, 97], [195, 39], [196, 49], [196, 98], [231, 132], [238, 34], [238, 136], [242, 143], [253, 154], [264, 165], [268, 67], [275, 176], [286, 187], [291, 97], [291, 194], [294, 49], [294, 98], [294, 196], [295, 59], [297, 198], [298, 149], [325, 13], [341, 143], [345, 138], [392, 49], [392, 98], [395, 79]]

For n=80 this prints [[64, 16], [65, 26]], but obviously 65 + 26 = 91 > 80.

Turn all the ifs into a single big if with ands connecting all the conditions? Saves quite a few chars, I think.

@Soham Yes, it does, thanks!

Could you also include the testcases I've added? (And could you perhaps see if you find some interesting test cases I should add too?)

@flawr Your requested test cases added

This is missing the reciprocals.

Where are 10/70, 20/60 and 30/50?

@Comintern are they supposed to be there?

@JanDvorak I'd assume so, the spec of a/b with a+b=n and a,b>0 wouldn't exclude them.

@Comintern true; good catch

you also assume a + b <= n whereas the question is a + b == n

Python 2 - 236
n=input()
r=range
f=float
l=len
for a in r(n):
 A=`a`;B=`n-a`
 for i in r(l(A)):
  for j in r(i+1,l(A)+1):
   for u in r(l(B)):
    C=A[:i]+A[j:];D=B[:u]+B[u+j-i:]
    if A[i:j]==B[u:u+j-i]and l(C)*l(D)and f(C)==f(A)/f(B)*f(D):print A,B


text:
The Bowlers-Golfers Fraction War
Introduction
Let's start by arranging all fractions from 0 to 1 in order of lowest denominator, then lowest numerator:
1/2, 1/3, 2/3, 1/4, 3/4, 1/5, 2/5, 3/5, 4/5, 1/6, 5/6, 1/7...
Note that duplicates aren't counted, so I haven't listed 2/4, 2/6, 3/6, or 4/6, since they already appeared in their simplified forms (1/2, 1/3, and 2/3).
Your task is now simple: given a positive integer nas a command line argument, print to standard output the nth fraction in the list. Thus, an input of 5 should yield an output of 3/4 (not 0.75).
Bowlers
Your goal is to solve this in the longest program possible. Your score is the number of characters.
Golfers
Your goal is to take existing answers, and golf them. When golfing those answers, remove one or more characters from the code, and optionally rearrange the remaining characters, in such a way that the resulting code is still a valid solution in the same language. Your score is the product of all the reductions. (So if you remove 10 characters from one answer, and 15 from another, your score is 150.)
Rules

A valid program must have at least three unique characters.
Only ASCII characters may be used.
If your program's size is reduced, your score is reduced accordingly.
When golfing a program...

Edit the code in the text of the answer
Change the character count listed
Leave the following comment: **Removed X characters (from Y to Z)** (in bold)

You may not golf a valid program into an invalid one.
The golfed program must work in some version of the language listed. So if the original answer is marked as Python, and the code only works in Python 2, you may golf it to a program that only works in Python 3.

Therefore, it is recommended (but not required) that you be specific in titling your answer, mentioning the version and/or compiler used.

If you already golfed an answer, you may golf it again.
If you golf the same answer multiple times, your score for that answer is the sum of your reductions.

For example, if you reduce 10 characters from a program, and later remove another 15, and also golf 7 characters from another answer, your total score is (10+15)*7=175.
This applies regardless of whether someone else golfed the program in between your golfings.

You may golf your own answer, but you do not receive any points for doing so.

Winners
I will try to keep this leaderboard periodically updated. If I make a mistake, please let me know, or else you can edit this post yourself.
Top bowlers

Dennis (CJam): 1.17 × 10678
Pppery (CPython 3.6.2): 25984
OldCurmudgeon (Java): 278

Top golfers

jimmy23013: 105.2 * 10152
Martin Ender: 2.8 * 1014484
Pppery: 2 * 104111

What if 2 persons want to golf the same answer ?

@Optimizer Whoever does it first.

Did you address the problem Dennis found in the sandbox at all?

@MartinBüttner I don't see any feasible way of actually preventing it (disallowing string literals is insufficient). However, I don't think implementing his idea is trivial, so if he manages to do it, good for him.

Any thoughts on requiring people to provide compiled versions of their submissions for this one?

Why the extreme strictness on IO?

CJam, 1.17 × 10678 bytes
",,,",KK#b:c~

Well, the string should actually contain 1,167,015,602,222,203,651,546,923,533,233,456,645,527,427,020,625,754,322,603,554,937,551,735,592,092,356,520,085,507,613,447,896,812,875,213,856,544,974,386,642,866,232,121,069,637,599,975,236,272,634,227,913,998,493,360,693,139,149,236,571,503,883,331,020,249,908,672,008,574,221,022,612,893,546,658,640,986,973,481,700,267,591,531,514,666,040,606,217,610,439,998,612,592,897,511,421,801,308,639,396,208,196,301,077,376,577,788,009,239,468,384,204,073,426,482,794,344,190,683,235,393,373,061,689,668,389,239,477,158,591,879,792,606,717,529,814,802,500,558,822,508,662,266,027,694,882,649,391,373,447,012,817,270,871,840,254,480,631,579,732,459,294,193,158,457,158,597,836,239,348,386,288,579,699,763,150,579,966,400,972,286,547,196,034,472,447,664,813,466,769,145,983,290,696,497,053,781,354,086,441,505,174,165,846,491,136,000,001,121,501,860,331,520,000,000,000,004,508,876,800,000,000,000,000,000,126 commas, but the editor didn't let me post the entire code... :(

Explain this unholy code-fu.

Forgot input didn't come from STDIN. That adds a couple of yottabytes...

@SohamChowdhury: Just a sec.

@Dennis don't spoil the fun! :D

On second thought, @MartinBüttner is right. This is cops-and-robbers, so I kinda benefit from people not knowing immediately how my code works. Yay for ninja edits!

Removed 6.42 × 10^1016 (from 6.42 × 10^1016 to 6.13 × 10^990) (@Dennis, please double check the new version, but I think you don't need to sort the filtered results)

@MartinBüttner: Good catch and nice golfer score. I started with fractions in their "natural" order. The sort was a leftover.

I'm already starting to think OP should use logarithmic scales for the highscore, seeing how the first scores are in magnitudes of ten o-O

Removed 6.13 × 10^990 (from 6.13 × 10^990 to 5.84 × 10^964)

@IngoBürk: Not sure if it would help. The base 10 logarithm of my latest answer's length is 5.212243085422315e152...

Removed 5.8410^964 characters (from 5.8410^964 to 2.05*10^912) I don't feel like I deserve credit for any of this blind copy-pasting of code (this is me literally stealing one of jimmy23013's golfs to a later answer), but that's what being a robber in a [tag:cops-and-robbers] challenge with many answers that use the same code but encode it differently means ...

Removed 2.05 × 10^912 characters (from 2.05 × 10^912 to 1.70*10^808)

Removed 1.70 × 10^808 characters (from 1.70 × 10^808 to 1.17 × 10^678)

+1 for the fact htat you wrote the number out in full

Python, 176 bytes
Not a bowler, but...
import sys,fractions
def f(t):
 c=0
 for i in range(t+10):
  for j in range(1,i):
   if fractions.gcd(j,i)==1:c+=1
   if c==t:return str(j)+'/'+str(i)
print f(int(sys.argv[1]))

+1 for not a CJam answer.

Removed 38 characters (from 227 to 189)

@Vincent Your edit introduces new characters such as 9, which as far as I can tell is against the rules.

@flornquake whoa I thought that the previous t+10 came out of the blue, didn't realize that it was actually made with the 't' of 'list', the '10' of 'n=100' and so on. Now I understand what makes that kind of challenge really interesting!

Removed 13 characters (from 189 to 176)

Suggested edit to import fractions as x and do x.gcd

So close, just whitespace prohibits that golf ...

Whoops, turns out my past golf to 146 wasn't valid; it made it not use command line arguments

**Removed 4 characters (suggested) (from 176 to 172)

@VFDan That golf is not valid because it adds the character b

CJam, 9.44 × 10284
"ddd",'iib:c~

The string actually contains 943,611,762,745,112,544,157,801,937,289,871,933,621,396,073,807,297,328,579,826,246,436,861,144,651,900,144,172,793,266,430,374,467,343,433,363,000,182,294,622,535,895,774,344,720,689,882,873,880,571,351,234,260,849,874,055,687,224,065,790,608,381,303,357,434,711,286,607,328,858,338,155,948,406,237,564,203,055,794,077,541,968,210,416,550,049,644,382,519,576,532,604,460,863,849 d's.
Note that the decoded program is slow in the online interpreter.

inb4 @MartinBuettner gets another few orders-of-magnitudes'-worth of points!

Removed 2.2 × 10^6049 characters (negligible compared to total number). I didn't shorten the decoded code, but I found a version with the same amount of characters, which uses a smaller character code at the first differing position.

If I'm understanding your method, couldn't you intertwine your three entries?

Removed 6.92 × 10^6831 characters (from 1.5 × 10^7222 to 1.5 × 10^7222)

@AndoDaan No, because you can always reduce the string to the shortest possible program that is a valid solution.

Removed another 1.9 × 10^6050 characters which adds to 2.1 × 10^6050 with my previous golfing.

@MartinBüttner ah, right. How about some kind of Ouroboros... by having mirroring (partial) quines at both ends. Hmmm, I should make an entry.

Removed 9.5 × 10^7221 characters (from 1.5 × 10^7222 to 5.98 × 10^7221)

@user23013 How does that work? How does o print ['/ "" [2 1]] as 1/2?

@MartinBüttner It should be ['/ 2 1]. o prints 1 and leaves others unchanged.

@user23013 ah that makes sense. there's an empty string there for reason, but that doesn't matter.

WTF, this code challenge is so broken...

that's enough ds for today

Removed 5.98 × 10^7221 characters (from 5.98 × 10^7221 to 4.33 × 10^7026) (credited to Dennis himself in the latest answer.)

Removed 4.33 × 10^7026 characters (from 4.33 × 10^7026 to 3.14 × 10^6831)

Removed 3.14 × 10^6831 characters (from 3.14 × 10^6831 to 1.09 × 10^291). Why didn't I think of this... This is a proof of concept, which obviously can be golfed better.

How do all if these work?

@Pavel Converting a very large number written in unary to a very large base, then interpreting the result as CJam code. For this specific answer, the base is only 105, but pre-golfing it was as high as 1380878341261486750656911803252309726876604105686729638072729543243701479670593033211008001443536626310535980077544691196522513327846303307992442770355560270350429006522588433404602387992091295744 (the character code of b raised to the power of itself)

Abuse of numeric casting allows me to do: Removed 1.0910^291 characters (from 1.0910^291 to 9.44*10^284) (and this, by the way, is my first golf that isn't copy-pasting someone else's code)

CJam, 3.8 × 1087 bytes
"ddd",'#i,(;(bb:c~

The string contains 3,795,999,425,660,798,101,493,706,445,244,921,058,557,321,207,441,420,808,131,205,973,714,113,789,081,612,593,756,565 d's.
The generator script for the previous version of this answer, which might be useful later:
"'/ea(i(_)),:)_m*{_~{_@\%}h!=\~>&},=~o"
"'bi,(;(;{#}*b":B~'d*`',B":c~"

Removed 39 × 2^(18 × 97!) ≈ 10^(5.2 × 10^152) characters (from 10^(5.2 × 10^152) to 2.8 × 10^101)

I think I lost.

@user23013: Dang! Serves me right for using 'b...

Removed 2.810^101 bytes (from 2.810^101 to 4.7*10^98) (more of the same copy-paste golfing of dubious score value, but on the plus side, this is down to only two digits in the exponent!)

@jimmy23013 Wait, your first version had a 520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 digits long number of characters?

@FabianRöling Yes. The numbers on this challenge got really excessive.

Removed 4.7 × 10^98 characters (from 4.7 × 10^98 to 3.8 × 10^87)

Removed 1.46 × 10^82 characters (from 3.8 × 10^87 to 3.8 × 10^87) (A small change that doesn't matter much.)

CJam, 9.44 × 10284
",,,",'iib:c~

The string actually contains 943,611,762,745,112,544,157,801,937,289,871,933,621,396,073,807,297,328,579,826,246,436,861,144,651,900,144,172,793,266,430,374,467,343,433,363,000,182,294,622,535,895,774,344,720,689,882,873,880,571,351,234,260,849,874,055,687,224,065,790,608,381,303,357,434,711,286,607,328,858,338,155,948,406,237,564,203,055,794,077,541,968,210,416,550,049,644,382,519,576,532,604,460,863,849 commas.

Editing an answer after somebody already golfed it didn't seem right, so here's my second attempt.

@MartinBüttner: Made a mistake. It wasn't even a valid submission.

Removed 2.1 × 10^7417 characters (from 2.1 × 10^7417 to 7.2 × 10^2749) (by using two commas from the string as the base)

^ You already finished learning CJam?

@SohamChowdhury No, but I've learned enough to figure out what he's doing. ;)

@MartinBüttner: Well, you got me there. I should have used d's in the string...

@MartinBüttner I bet you have a tab open with the "Operators" wiki page. :P

@SohamChowdhury I did for the Dennis's first answer. Not for this one ;).

@MartinBüttner: Not that it matters, but you could have left just commas in the string. Its not like there's a shortage... :P

@Dennis yeah, no clue what I was thinking :D. feel free to change it for readability.

@Dennis How exactly did you count the number of commas?

@Hankrecords The string literal is followd by ,, so we're only interested in its length. The actual code I want to execute is ea~i_),1f+_m*{_~{_@\%}h;1=\~>&},\(=~'/@, and this converts the program to base 44 44#.

I didn't know CJam has a Lenguage builtin...

Removed 7.210^2749 characters (from 7.210^2749 to 1.09*10^291) Credit to jimmy23013 for doing this to your previous answer. I'm surprised this wasn't thought and done long long ago.

Interesting that the first CJam answer ended up being the least golfable, while all the others were golfed down to nothing ...

Removed 1.0910^291 characters (from 1.0910^291 to 9.44*10^284)

Java - 278
import java.math.*;void m(String a){BigInteger i=null;BigInteger n=i.ONE;BigInteger d=n.add(n);BigInteger e=n;for(i=e;i.compareTo(i.valueOf(Integer.parseInt(a[0])))<0;i=i.add(e))do if((n=n.add(e)).compareTo(d)>=0)d=d.add(n=e);while(!n.gcd(d).equals(e));System.out.print(n+"/"+d);}}

Ungolfed:
import java.math.*;
void m(String args[]){
        BigInteger i=null;
        BigInteger n=i.ONE;
        BigInteger d=n.add(n);
        BigInteger e=n;
        for(i=e; i.compareTo(i.valueOf(Integer.parseInt(args[0])))<0; i=i.add(e))
            do
                if((n=n.add(e)).compareTo(d)>=0)
                    d=d.add(n=e);
            while(!n.gcd(d).equals(e));
        System.out.println(n +"/"+d);
    }
}

Original version
I have made no attempt to arbitrarily extend this solution. Not sure if that will gain me or lose me points. It is, however, a correct solution that will work for very large numbers.
public class Test {

    static class Fractions implements Iterator<String> {

        // Start at 1.
        BigInteger numerator = BigInteger.ONE;
        // Start at 2.
        BigInteger denominator = BigInteger.ONE.add(BigInteger.ONE);

        @Override
        public boolean hasNext() {
            // Never ending!
            return true;
        }

        @Override
        public String next() {
            String next = numerator + "/" + denominator;
            do {
                // Keep selecting the next one.
                step1();
                // Until they are relatively prime.
            } while (!numerator.gcd(denominator).equals(BigInteger.ONE));
            return next;
        }

        private void step1() {
            // Take a single step.
            numerator = numerator.add(BigInteger.ONE);

            if (numerator.compareTo(denominator) >= 0) {
                // num >= den - step denom up and num rewinds to 1.
                numerator = BigInteger.ONE;
                denominator = denominator.add(BigInteger.ONE);
            }
        }

    }

    // Returns the nth fraction.
    public String nthFraction(BigInteger n) {
        Iterator<String> f = new Fractions();
        for (BigInteger i = BigInteger.ONE; i.compareTo(n) < 0; i = i.add(BigInteger.ONE)) {
            f.next();
        }
        return f.next();
    }

    // Returns the nth fraction.
    public String nthFraction(long n) {
        return nthFraction(BigInteger.valueOf(n));
    }

    public void test() {
        Iterator<String> f = new Fractions();
        for (int i = 1; i < 100; i++) {
            System.out.println(i + "=" + f.next());
        }
    }

    public static void main(String args[]) {
        try {
            //new Test().test();
            if (args.length >= 1) {
                System.out.println(new Test().nthFraction(Integer.parseInt(args[0])));
            } else {
                System.out.println(new Test().nthFraction(5));
            }
        } catch (Throwable t) {
            t.printStackTrace(System.err);
        }
    }
}

1/2 should be the 1st, not the 0th fraction, and the 5th fraction should be 3/4 according to the question.

@user23013 - Good call - fixed now - thanks.

And while I'm going to golf this answer, is there any way to compile this program without those import lines?

Removed 1779 characters (from 2102 to 323) (without reusing those characters in comments and the test function). Also note that it doesn't work for too large numbers since the input is parsed as an integer.

Removed 45 characters (from 323 to 278). Yes, I know this is a terrible hack, but functions may output to stdout, and "program" includes functions per the applicable meta posts, so this should be a valid golf

CPython 3.6.2, 25984 bytes
t=int().__sub__(int()==int())
t=t.__sub__(int().__sub__(t));t=t.__sub__(int().__sub__(t));t=t.__sub__(int().__sub__(t));t=t.__sub__(int().__sub__(t));t=t.__sub__(int().__sub__(t));t=int().__sub__(t).__sub__(int()==int())
d=__builtins__.__dict__;l=list(d);
c=d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d))
_=d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d))\ndd=d[    l[_]].__dict__
ll=list(dd)
d[l[d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d))]](dd[ll[d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d))]](d[l[_]](),(d[l[c]](d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d))),d[l[c]](d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d))),d[l[c]](d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,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d,d,d,d,d))),d[l[c]](d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d))),d[l[c]](d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d))),d[l[c]](d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d))),d[l[c]](d[l[t]]((d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d))),d[l[c]](d[l[t]]((d,d,d,d,d,d,d,d,d,d))))))

This answer was created by porting the code of Soham Chowdhury's Python answer through the cracker I wrote for wizzwizz4's cop answers to restricted mini challengs.
I hope I'm not violating some rule against posts to old cops-and-robbers challenges.

All I can say is d

Ruby, 488 412 377 347 341 214 bytes
Starting with a more "regular-looking" program; Curious to see what awful things you can do to it.
require 'set'
g=Enumerator.new do|y|
v=Set.new
d=2
loop do
(1...d).each do|n|
x=n.to_f/d
if v.include?(x)==false
v.add(x)
y.yield(n.to_s+'/'+d.to_s)
end
end
d+=1
end
end
i=0
$*[0].to_i.times do
i=g.next
end
puts i

Removed 76 bytes (from 487 to 411). Remember to remove unnecessary whitespace from your code ...

Also, why did you name your variable denumerator rather than denominator

@ppperry Haha! Probably a copy/paste or renaming gone wrong :D

Removed another 35 bytes (from 411 to 376), which adds (coincedentally) to 111 bytes with my previous golf.

Removed another 30 bytes (from 376 to 346) (by inlining variables only used once)

Removed another 6 bytes (from 346 to 340) adding up to 147 bytes removed.

Removed another 120 bytes (from 340 to 213) I was hoping to come up with more algorithmic golfs before doing this, but I can't think of any, so here goes the one-char variable names ...

Answers are explicitly required to use command line arguments by the challenge. This one doesn't

I've edited this answer to replace gets with $*[0] to fix the issue @pppery pointed out, retroactively adding one to all of the bytecounts.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Rolling digital number lock
There's a simple digital number lock. After each button press the lock checks if the previous four presses constitute the correct code. I.e. typing 44445 tests two codes: 4444 and 4445. You must brute force it with a code golfed program.
Rules

Your program must test numbers by printing ASCII digits 0-9 to standard output. Other output, if any, will be ignored.
The program must be deterministic. If you need "random" numbers, you must use a deterministic generator with a well defined seed.
Infinite output beyond all 10^4 codes is allowed. Opening the lock is considered to stop the program.

Scoring

Calculate the average digits of output needed to crack the lock. I.e. search the output string for every possible four digit sequence and record where it first appears.
Add the source code length in bytes. The program must be fully functional, you are not allowed to omit imports or other boilerplate.

Score = Average digits to crack + codelength in bytes

Example entry
Python, 35 bytes.
for i in range(9001):print '%.4d'%i

Score: 8444.9837 + 35 = 8479.9837
Other
Simple, stupid Python program to verify score of an output string:
d = {}
s = ''.join(c for c in s if '0' <= c <= '9')
for i in range(len(s)-4):
    t = s[i:i+4]
    if t in d:
        continue
    d[t] = i + 4
    if len(d) == 10000:
        break
print sum(d.values()) / 10000.

The example uses range(9000), how does it print lock with for example code: 9999?

@RoyvanRijn, whoops, typo. Should be fixed.

Good concept but the scoring needs to be clarified. If you want to use a mixed scoring system, code-golf and fastest-algorithm tags are redundant, just leave code challenge. Time in milliseconds, minutes or days? On whose machine? (presumably yours, which means you will have to test.) Note that bytestime is a lot less sensitive to machine speed than bytes+time. With bytestime running on a machine 10 times as slow will multiply everyone's score by 10 without changing the order of the scores but bytes+time will favour long fast programs on a slow machine and short slow ones on a fast machine.

If I understand correctly the score is the average characters it takes to crack each code (0000 to 9999) in the output (no matter how long the output is) + the bytes of the program.

@RoyvanRijn Ok, on re-reading it, you're right. It's asking for the shortest sequence. I believe optimal sequences are possible, which makes it very close to this http://codegolf.stackexchange.com/q/13088/15599

@steveverrill, yes, optimal sequence is possible, but not necessarily short in every language. Feel free to change the tags if I got them wrong.

This is basically a fight to get all sequences in minimal length of both code and sequence. Exactly what asked in the other question.

@Optimizer, the objective criterion in that question is just code length, but maybe this is too close.

Exactly. This is this much close, that I can literally copy paste the top three answers as is in there and all three of them will be better than the one posted below.

Java 5218
This is the (golfed) code:
class a{int[]a=new int[5];public static void main(String[]a){new a().b(1,1);}void b(int t,int p){if(t>4)for(t=0;++t<=p&&4%p==0;)System.out.print(a[t]);else{a[t]=a[t-p];b(t+1,p);for(a[t]=a[t-p];++a[t]<=9;)b(t+1,t);}}}

It prints a specially crafted sequence to stdout. The completed sequence has all combinations, only once, in the shortest way possible. The total length is 10.000 with the first combination after 4 (obviously) and the last after 10.000. So if I understand the challenge correctly my score is:
4 + ((10000-4)/2) = 5002 avg length to break the code
5002 + 216 (code length) = 5218

Obviously this score will be improved (Java is pretty verbose), so I'm not going to tell you the name of the sequence I'm using...

You mean De Brujin sequence? :D

Haskell, 120 bytes + 5001.5 = 5121.5
import Data.List
main=print$(nub$sort[sort s|x<-[1,2,5,10],s<-sequence$replicate x['0'..'9'],any(/=s!!0)s||x<2])>>=id++"000"

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Animation of Code Golf
When I see code-golf entries that knock a few characters off, whittling down the code, I go look at the edit history for a side-by-side diff.  See and learn :)
This challenge is to make a program that produces the prettiest animated diffs.

The input will be any ordered series of text versions.
The program may be written in any programming language.
It is allowed that the program limit itself to input data in some specific programming languages.
The program should not be tuned to the specific input data; the program should be generic and work for any ordered series of text versions.
For each version in the input there must be a corresponding time in the output animation where the full text of the version is displayed.  You must animate the diff between version stages, and all version stages must be present and in order in the output.  On these key frames, the version size must be shown and the viewer should understand this is a complete version they are seeing at that point.
The program may not use any third party code to compute the diffs.
Syntax highlighting output is optional.  If the program colours syntax, it may not use any third party code to do so.
The output will be an animated GIF.
The program may use a third party library to author the GIF.
This is a popularity-contest, so as per the definition of popularity-contest on this site, the entry with the most votes wins.

Here's a simple example script that uses Python's ndiff and Pillow's rudimentary animated GIF support and animates each add and remove step:

Personally, I think this a pretty poor job.  It doesn't do syntax highlighting, it doesn't try and move code chunks that get rearranged, it doesn't feel like someone is live editing it, and so on.  It also breaks the rules regards showing the size of the input in bytes on key frames, and it uses a third party library to do the diffing.  Lots of room for improvement!
And hopefully the popular entries will become useful fun tools for the codegolf.stackexchange.com community too.  So its appreciated if the programs are easy for others to get running and use.

Comments purged as the extended conversation here seems to be coming to a stop. Discussion about this post can be found on this meta question.

(OP)

This is based on the example Python script in the question.
I used the simplest edit distance rather than a cleverer patience diff.
For aligning genomes there's Multi Sequence Alignment algorithms and they could well make an even better job than just considering each pair of adjacent frames?
I was pleasantly surprised how straightforward it was to implement edit distance for the diff, and made it compatible with Python's difflib.ndiff format.  There are plenty of Python implementations of edit distance to be found on the web, but I think my formulation is that little bit tidier and deals with the tricky but essential part of actually determining the path in the table too; in our context, we need to know the steps to turn one into another and not just how many steps there are.
I introduced syntax highlighting using a very simple tokenizer that ought to be able to cope with most c-like languages including, by its laxity, Python and such.  It splits the source into punctuation, whitespace, strings (with escape support) and everything else is an identifier and checked against a list of keywords.  The colouring is also easy to change.
It was easy to integrate the syntax highlighting into a dynamic language; the highlighter outputs a list of character and colour pairs, and the differ is agnostic to whether its diffing strings or any arbitrary iterables of comparables!  An interesting - and deliberate - effect of highlighting first and then diffing is that characters that remain unchanged but change colour get animated.  I didn't want to compute the highlight each frame as that would mean that as you delete a closing string you'd suddenly flash a big chunk of text up as string.
Python's support for authoring GIF is rather limited.  PIL doesn't do it, and Pillow does it rather badly.  I use Pillow, but then have to run through gifsicle to compress and add looping etc; Pillow doesn't correctly write frame timing and doesn't let you manage disposal methods etc, which is a shame as the differ has so much better understanding of the scene than a post-processing step dealing with flattened frames :(
Sourcecode

I implemented the same diff algorithm. Later I rewrote it using Cython and gained a 100x speedup.


text:
Which positive integer is equal to it's own Scrabble score when spelt out in full?
The Challenge: Make the shortest program to confirm that 12 is the answer.
(The puzzle is from Ian Stewart's "Cabinet of Mathematical Curiosities".
This is my first code golf question. I hope this type of thing is allowed)
In Scrabble the following are the letter scores:
AEIOULNRST score 1 each
DG          score 2 each
BCMP        score 3 each
FHVWY       score 4 each
K           scores 5
JX          score 8 each
QX          score 10 each.

I would remove the answer from the description and add some rules. Like hard coding is not allowed etc. Also might be fun if people can find other things. Perhaps its possible that the score and the number(digits) are palindrome (and numbers consist of more than 2 digits.

Very similar to Determine a string's Scrabbe score and validity.

@Geobits I see what you mean but just because they both have to do with scrable and the score don't make it a duplicate in my opinion. He did ask for something specific which doesn't happen in the question you posted. As I see it the focus in the other question lies in validating the word which isn't the case here.

@TeunPronk My point is that (as it stands now), you could just use input "twelve" to those answers and compare it to 12 to "confirm that 12 is the answer". This one is unclearly written, but I'd retract if it's given a good spec that better distinguishes it from the other.

@Geobits True, but that would make any BF question a duplicate to the one where you had to make a BF generator/intepretor. I partially agree with you, the challenge needs some editing but I do think it's unique enough compared to the other one.

@TeunPronk My close vote was for unclear, not duplicate. I mentioned the other one in comments so that any editor wouldn't unknowingly make it an exact duplicate.

SIX AND TWENTY = TWENTY AND SIX = 26

@Geobits IX if roman numerals are allowed. Questions that need to write "no hardcoding the answer" always run into problems, as it's difficult to define what constitutes hardcoding. I think making it a search for other numbers would make a much better question, but as demonstrated by these examples, allowable spellings must be clearly specified. I think allowing blank tiles would increase the number of hits a lot (but only 2 as in the scrabble set, not infinite because then you could do anything.) Upvoting and closevoting. Donagh, check out http://meta.codegolf.stackexchange.com/q/2140/15599

@TeunPronk Thanks for helpful comments. I included the answer because I thought as a programming challenge it is way below the capacity of any programmer worth his salt.I am working on a way to refine the question.

@steveverill Thanks for upvote. I was not aware of meta.codegolf per se. Thanks for the pointer. How to proceed? Should I remove the question from here and ask it in [link]meta.codegolf.stackexchange.com instead? n00b apologises for ignorance.

@DonaghMcCarthy Post your question as an answer to this one: http://meta.codegolf.stackexchange.com/questions/2140/sandbox-for-proposed-challenges Then you can get input and feedback on it. I don't know if you're supposed to edit and re-open this question, or delete it and post a new one. You can leave it up for now, and edit in a link to your sandbox post on the meta site. i.e. This question is being discussed on the sandbox here (link)

Either try and solve the problem here, or delete and repost in the sandbox (then when it's fixed you can delete and post back here). Don't do both. I think sandbox is the best place because there are quite big issues with this question. Even allowing for some flexibility, the number of hits is going to be small, which makes the question vulnerable to hardcoded answers. Throwing an idea out: I suggest the user might enter a number (in figures)between 0 and 999 (or 999999) and the program would output the scrabble score for that number. Use of a and & one with 100 would need clarification.

@steveverrill That's a good reply. I will delete and re-post in sandbox. Your suggestion regarding user input is well made - I had the same idea myself later. As a n00b, it was a bit hairy having those heavy hitters pounce on my question before I had a chance to examine it on screen. Their vigilance is commendable.

Another idea for user input might be to have them input numbers n,m, and find all integers up to m with score n.

@Geobits - yep, that would certainly make the challenge more interesting. I will see what I can do to incorporate it. Originally I brought the puzzle in verbatim but it is not perhaps interesting enough for the programming fraternity as it stands. I think I get it.


text:
String.prototype.isRepeated
UPDATE : isaacg's Pyth submission is the winner!

Many of you must have heard that there is a cooler version of JavaScript in town (read ES6) which has a method String.prototype.repeat so that you can do
"Hello, World!".repeat(3)

and get
"Hello, World!Hello, World!Hello, World!"

as the output.
Your job is to write a function or a program in a language of your choice which detects if a string has been gone under such transformation.
i.e. The input string can be represented as an exact n times repetition of a smaller string. The output (as function's return statement or STDOUT) should be truthy if the string can be or falsy if the string cannot be represented as a repetition of smaller string.
Some sample input:
"asdfasdfasdf"  // true
"asdfasdfa"     // false
"ĴĴĴĴĴĴĴĴĴ"     // true
"ĴĴĴ123ĴĴĴ123"  // true
"abcdefgh"      // false

Note that the last input is false, thus n should be greater than 1
Complete rules

Write a function/program in any language to input (via function argument/command line args/STDIN) a string
Return/Print truthy value if the given string is formed via an exact repetition of a smaller string, repeating at least twice.
Maximum size of the input string is ideally Infinity
String can have all possible ASCII characters
This is a code-golf so smallest code in characters wins.

What should "" - the empty string - return? (It contains an infinite number of copies of the empty string.)

@billpg falsy value

Are you tie-breaking by votes? The common practice is earlier submission I think (well, the first one that got golfed down to the tying score). But I'm not sure that's written down as the default tie-breaker anywhere, so ultimately it's up to you.

Time between their posting is only 30 minutes. I will not consider that to be enough for winning :) . Since that time won't change now, but votes can, I went with votes

This question should be renamed into xnor :) He is the man!

Pyth, 9
/:+zz1_1z

Or
}z:+zz1_1

These are both close translations of @xnor's python answer, except that they take input from STDIN and print it. The first is equivalent to:
z = input()
print((z+z)[1:-1].count(z))

0 for False, 1 for True.
The second line is equivalent to:
z = input()
print(z in (z+z)[1:-1])

False for False, True for True.
Pyth's official compiler had a bug related to the second one, which I just patched, so the first is my official submission.

I was just searching for a way to inform you about that bug (the Boolean doesn't get printed). Didn't think of the first and using x was too long...

Yeah, the bug is fixed now. Also, if you want to report bugs, a good way might be to open an issue on the github site, here: https://github.com/isaacg1/pyth/issues

Oh, there it is. I don't know my way around GitHub, and I never noticed the navigation panel on the right...

Python (24)
lambda s:s in(s+s)[1:-1]

Checks if the string is a substring of itself concatenated twice, eliminating the first and last characters to avoid trivial matches. If it is, it must be a nontrivial cyclic permutation of itself, and thus the sum of repeated segments.

Oh dear, that's so much better than my trivial solution...

A trivial translation into Golfscript yields 10 chars: ..+);(;\?)

I don't quite understand how this works. Can you give a manually explained example of how this would handle a string?

@NateKerkhofs take abcabc. s+s turns it into abcabcabcabc. the [1:-1] chops of the two ends to yield bcabcabcabcab. and then s in ... tries to find abcabc as a substring of that. This substring can't be found in either of the original half, because they have both been shortened, so it must span both halves. In particular, it must have its own end before its start, which implies that it must be made up of identical (repeated) substrings.

Won't this fail on two character strings such as ab?

You chop it after you double it. ab becomes abab becomes ba, so it returns false, while aa becomes aaaa becomes aa, which returns true.

(how) will it work with 3 copies? for example, "qweqweqwe"

@SargeBorsch It works just the same: qweqweqwe in weqweqweqweqweqw is True.

Regex (ECMAScript flavour), 11 bytes
Sounds like a job for regex!
^([^]+)\1+$

Test it here.
I've chosen ECMAScript, because it's the only flavour (I know) in which [^] matches any character. In all others, I'd either need a flag to change the behaviour of . or use [\s\S] which is three characters longer.
Depending on how we're counting the flag, that could of course be a byte shorter. E.g. if we're counting pattern + flags (e.g. ignoring delimiters), the PCRE/Perl equivalent would be
/^(.+)\1+$/s

Which is 10 bytes, ignoring the delimiters.
Test it here.
This matches only strings which consist of at least two repetitions of some substring.
Here is a full 26-byte ES6 function, but I maintain that regular expression submissions are generally valid:
f=s->/^([^]+)\1+$/.test(s)

^(.+)\1+$ works for me, which is 9 bytes. It doesn't work for you ?

@Optimizer Try a string with line breaks.

I tried asd\nasd\nasd\n . It works

@Optimizer http://refiddle.com/refiddles/5417fb2475622d4df7e70a00 doesn't seem to work for me (and it shouldn't)

Yup, that doesn't work. Maybe it escapes the \  when I write \n manually

@Optimizer Well, the other way round: that tester doesn't understand escape sequences at all (and why would it), so \n is just two ASCII characters like any other ones.

I would expect a regex matcher to not escape strings. When I test in web console or scratchpad, \n is treated as single character.

@MartinBüttner Good point. I never thought about that.

The 10-byte version on regex101.com (complete with explanation): http://regex101.com/r/qZ0jP3/1

@Ajedi32 oh yeah, that's actually where I tested it. Forgot to add the link. Thanks!

@Ajedi32 It can also be done in 10 bytes using \X: ^(\X+)\1+$

CJam, 9
q__+)@+#)

Similar to xnor's idea.
q      " Read input. ";
__+    " Duplicate twice and concatenate them together. ";
)      " Remove the last character of the longer string. ";
@+     " Insert that character at the beginning of the shorter string. ";
#)     " Find the shorter string in the longer string, and increase by one. ";

+1 obligated to upvote this ahead of my own CJam answer

Why the need for the final )?  I think its reasonable to have -1 mean FALSE and >=0 mean TRUE

@DigitalTrauma I think 0 is falsy in CJam... for operators like g and ?.

@DigitalTrauma: Whether it's needed ultimately depends on the OP, but strictly speaking only zero is considered falsy in CJam.

@user23013 @Dennis But what about the # find operator?  Surely the result of that is also "truthy" from the success vs failure perspective?

@DigitalTrauma: The fact that # returns a truthy value on failure is a real annoyance. Nine times out of ten, I don't need the actual index; I just want to know if there's a match. In a sense, you're right. I guess I've just learned to put up with the extra byte it adds to my answers...

@DigitalTrauma Truthy and falsy usually means the value can be converted to boolean as true or false, which shouldn't be different for different operations. But well, the CJam documentation didn't mention what is truthy or falsy, or anything related to boolean data types.

@Dennis I think this is good discussion, so I've taken it to meta http://meta.codegolf.stackexchange.com/questions/2190/interpretation-of-truthy-falsey

APL, 11
2<+/x⍷,⍨x←⍞

Explanation
⍞ takes string input from screen
x← assigns to variable x
,⍨ concatenates the string with itself
x⍷ searches for x in the resulting string. Returns an array consisting of 1's in the starting position of a match and 0's elsewhere.
+/ sums the array
2< check if the sum is greater than 2 (as there will be 2 trivial matches)

CJam, 10 bytes
I caught the CJam bug.  My first answer, so probably can be golfed some more:
q__+(;);\#

Outputs -1 for FALSE and a number >=0 for TRUE

Welcome to the club!

GolfScript, 10 bytes
..+(;);\?)

Yet another implementation of xnor's clever idea.

Hahaha, I just posted this a minute ago: http://codegolf.stackexchange.com/questions/37851/string-prototype-isrepeated#comment86713_37855 . I thought about posting it as an answer, but I thought that trivial translations are uninteresting.

I even checked for new answers this time, but not for new comments... Your code is missing the ) though; when there's not match, it will print -1. If you're going to post that as an answer, I'll gladly delete mine.

I added the ) just before you posted your answer (I edited the comment)

I don't care about rep or anything, so I'll just let you have the answer ;-).

Your call. I've hit the rep cap anyway... :P

Improved version (in CJam): q__+)@+#). It doesn't work in GolfScript.

@user23013: Not again. I was just going to post that! There are too many CJammers out there by now... :P

@user23013: You should add that as an answer.

Python - 59 57
lambda s:any([s*n==s[:n]*len(s)for n in range(2,len(s))])

Pure bash, 30 bytes
Simple port of @xnor's clever answer:
[[ ${1:1}${1:0: -1} =~ "$1" ]]

Exit code is 0 for TRUE and 1 for FALSE:
$ for s in 'Hello, World!Hello, World!Hello, World!' 'asdfasdfasdf' 'asdfasdfa' 'ĴĴĴĴĴĴĴĴĴ' 'ĴĴĴ123ĴĴĴ123' 'abcdefgh'; do echo "./isrepeated.sh "\"$s\"" returns $(./isrepeated.sh "$s"; echo $?)"; done
./isrepeated.sh "Hello, World!Hello, World!Hello, World!" returns 0
./isrepeated.sh "asdfasdfasdf" returns 0
./isrepeated.sh "asdfasdfa" returns 1
./isrepeated.sh "ĴĴĴĴĴĴĴĴĴ" returns 0
./isrepeated.sh "ĴĴĴ123ĴĴĴ123" returns 0
./isrepeated.sh "abcdefgh" returns 1
$

Note =~ within [[ ... ]] is the regex operator in bash.  However "Any part of the pattern may be quoted to force it to be matched as a string".  So as ai often the case with bash, getting quoting right is very important - here we just want to check for a string submatch and not a regex match.

TI-BASIC - 32
I thought I'd try a tokenized language. Run with the string in Ans, returns 0 if false and the length of the repeated string if true.
inString(sub(Ans+Ans,1,2length(Ans)-1),sub(Ans,length(Ans),1)+Ans

Amazing how it's a one-liner.

But... but... I was going to use TI-BASIC :P +1

@Timtech Well, note to anyone trying string manipulation in TI-BASIC: Don't try string manipulation in TI-BASIC. :P That was so hard to make and optimize.

Good idea. String manipulation is one of the hardest things to do. However, I've posted several answers like this, so I guess now you have a competitor ;)

Bring it on! :P

ECMAScript 6 (189)
(function(){var S=String.prototype,r=S.repeat;S.isRepeated=function(){return!1};S.repeat=function(c){var s=new String(r.call(this,c));if(c>1)s.isRepeated=function(){return!0};return s}}());

< console.log("abc".isRepeated(),"abc".repeat(10).isRepeated());
> false true

Surely this is the only valid solution? For example, the word (string) nana isn't necessarily created from "na".repeat(2)

"nana" isn't, but the question is not testing whether .repeat was used or not. Rather, whether the string is a repeated one or not

I know, I was just trying to be a smart-arse :P

ECMAScript 6 (34 36)
Another ES6 answer, but without using repeat and using xnor's trick:
f=i=>(i+i).slice(1,-1).contains(i)

Must be run in the console of a ES6-capable browser such as Firefox.

C 85
l,d;f(s){return l=strlen(s),strstr(d,strcpy(strcpy(d=alloca(l*2+1),s)+l,s)-1)-d-l+1;}

It turned out to be quite long but external functions are always like that.
It came to my mind that I could rewrite every string function replacing them by a loop or a recursive one. But in my experience it would turn out longer and frankly I don't want to try that out.
After some research I saw solutions on high performance but not as clever (and short) as xnor's one. just to be original... i rewrote the same idea in c.
explanation:
int length,
    duplicate;
int is_repetition(char *input)
{
    // length = "abc" -> 3
    length = strlen(input);
    // alloca because the function name is as long as "malloc"
    // but you don't have to call free() because it uses the stack
    // to allocate memory
    // duplicate = x x x x x x + x
    duplicate = alloca(length*2 + 1);
    // duplicate = a b c 0 x x + x
    strcpy(duplicate, input);
    // duplicate = a b c a b c + 0
    strcpy(duplicate + length, input);
    if (strstr(duplicate,duplicate + length - 1) != duplicate + length - 1)
        // repetition
        // e.g. abab -> abababab -> aba[babab]
        // -> first occurence of [babab] is not aba[babab]
        // but a[babab]ab -> this is a repetition
        return 1;
    else
        // not repetition
        // e.g. abc -> abcabc -> ab[cabc]
        // -> first occurence of [cabc] is ab[cabc]
        // it matches the last "cabc"
        return 0;
}

Jelly, 3 bytes
ṙJċ

Try it online!
Same as this answer (maybe the later challenge is a generalization of this one?).

ECMAScript 6 (59 62 67 73)
Not a winner, but seems like there should at least be one answer actually in ES6 for this question that actually uses the repeat function:
f=i=>[...i].some((_,j)=>i.slice(0,j).repeat(i.length/j)==i)

Must be run in the console of a ES6-capable browser such as Firefox.
It does a lot of unnecessary iterations, but why make it longer just to avoid that, right?

Edit #1: Saved a few bytes by converting it into a function. Thanks to Optimizer!
Edit #2: Thanks to hsl for the spread operator trick to save more bytes!
Edit #3: And thanks to Rob W. for another 3 bytes!

You can just convert it into a function to save more bytes there

@Optimizer True, I guess it doesn't have to be "stdin". Your live up to your name :)

I haven't tested this, but you should be able to use the spread operator for [...i] instead of i.split('')

@hsl Crazy, that works. I didn't know the spread operator works like that. Originally I desperately tried to use it to create an array with the range 0..N. Thanks!

.slice(0,j) is one character shorter than .substr(0,j). Further, the conversion to an integer seems unnecessary |0 can be removed (using |0 actually reduces the usefulness of the method because it will fail for repetitions that exceed 2^31).

@RobW Mh, weird. I added the |0 because I got an error. Doesn't seem to error out now, though, so I guess I really can remove it. Thanks!

Java 8, 28 bytes
s->s.matches("(?s)(.+)\\1+")

Try it online.
Explanation:
Checks if the input-String matches the regex, where String#matches implicitly adds ^...$ to match the entire String.
Explanation of the regex itself:
^(s?)(.+)\1+$
^                Begin of the string
 (s?)            Enable DOTALL-mode, where `.` also matches new-lines
     (           Open capture group 1
      .+          One or more characters
        )        Close capture group 1
         \1+     Plus the match of the capture group 1, one or more times
            $    End of the string

So it basically checks if a substring is repeated two or more times (supporting new-lines).

Vyxal, 6 bytes
żḢ/v≈a

Try it Online!
Explained
żḢ/v≈a
  /    # Split the input string into pieces of
żḢ     # range [2, len(input)]
   v≈a # do any of those have all the same item

J-uby, 51 36 25 bytes
Based on my Ruby answer. Returns the string for truthy and nil for falsy.
~:[]%(~:*&2|~:[]&(1..-2))

Attempt This Online!
This is equivalent to the lambda ->s{ (s*2)[1..-2][s] }.

Ruby -nl, 19 bytes
Another port of xnor's answer. Takes input on stdin; prints the string if it's repeated and nil otherwise.
p ($_*2)[1..-2][$_]

Attempt This Online!

Japt, 6 bytes
²é ¤øU

Try it
Boring copy of the common logic from other answers:
²é ¤øU
²      # Duplicate the input
 é     # Move the last character to the front
   ¤   # Remove the first two characters
    øU # Return true if it still contains the input

Japt, 6 bytes
¬x@¥éY

Try it
More interesting, but has a weirder output; 1 means false, any other output means true. Identical to this answer on a different challenge, but discovered separately.
Explanation:
¬x@¥éY
¬      # Convert input to an array of characters
 x@    # Apply a function to each one, then sum the results:
    éY #  Rotate the input string a number of times equal to the current index
   ¥   #  Return 1 if it's still equal to the input, 0 otherwise

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Programmer's Garden
Programmer's Garden
Being a professional software developer, you cannot risk exposing yourself to the harsh non-artificial light of the sun, but you also have a soft spot for flowers, and want to keep your garden in good shape all year round.
To this end, a gardener is hired each month to tidy up the flowerbed at the foot of your house. However you need to make sure the gardener is doing his job properly, and work out a suitable payment for the hard working fellow. Naturally a software solution is best.
Input
Your program will be fed input describing the flowerbed as it appears current, and details of items that need to be removed. The program must output the garden devoid of the clutter, and print out a breakdown of the gardeners pay. The input can be either be from STDIN, or as a single command line argument.
The first line of input is of the format
width height unwanted_item_type_count

where width is the width of the flowerbed, height is the height of the flowerbed (both in ASCII characters), and unwanted_item_type_count tells you how many lines will following containing a description of a type of item to be removed from the garden.
Each line for each unwanted type of item is of the format
width height string_representation name fee_per_item

where width is the width of the item, height is the height of the item (both in ASCII characters), string_representation is the string representation of the item without line breaks, name is an identifier for the type of item (spaces will be replaced with underscores), and fee_per_item is how much the gardener must be paid for the removal of each type of item.
For example
3 2 .R.\|/ rouge_flower 3

Represents an item type of name rouge_flower, which costs 3 to remove, and looks like this:
.R.
\|/

The items will not contain spaces, and no item may have a border consisting entirely of dots, and the string representation will also be the exact size described. Thusly, all of the following are invalid inputs:
3 1 ( ) space 0
1 1 . dot 0
2 1 .! bang 0
3 2 .@.\|/. plant 0

Note that 0 is however a valid fee (fees will always be integers greater than -1).
Note also that the flowerbed is predominately made up of dots (.) rather than spaces, and you can safely use whitespace as delimitation for all the inputs. The flowerbed is always bounded by dots itself.
After the unwanted item types are listed, then comes the ASCII representation of the flowerbed of given width and height.
Output
Output should be to STDOUT, or suitable alternative if your language doesn't support it.
The output starts with a print-out of the flowerbed, but with all unwanted items removed (replaced with dots), so you can see how it should appear and check the gardener has done his job. Each item in the flowerbed will be surrounded by a rectangle of dots, and will be one-contiguous item (i.e. there will be no separating dots inside the item). For example
.....
.#.#.
.....

shows 2 separate items
.....
.\@/.
.....

shows 1 item
......
.#....
....|.
....|.
.o--/.
......

is invalid, as while the stone (#) can be matched, the snake (you couldn't tell it was a snake?) cannot because the stone interferes with the required surrounding of dots.
...
\@.
...

This is also invalid, as the snail is on the edge of the flowerbed, and the edge must always be bounded by dots in a valid input.
After this, there should be a listing of each type of unwanted item, giving the count, the cost per item, and costs for all the items (count * cost per item), in the format:
<count> <name> at <cost_per_item> costs <cost>

After this, there should be a single line yielding the total cost (the sum of the costs for unwanted items):
total cost <total_cost>

Example
For this given input
25 18 3
4 2 .\/.\\// weeds 5
2 1 \@ snails 2
1 1 # stones 1
.........................
.\@/.................\@..
............\/...........
......O....\\//..^|^.....
.#...\|/.........^|^.....
..................|......
.................\|/.....
..\@.....\/...........#..
........\\//....#........
....*....................
...\|/......\/......\@/..
...........\\//..........
..................*......
.......\@/.......\|/.....
...O.....................
..\|/.......*............
.......#...\|/....\@.....
.........................

The program should produce this output
.........................
.\@/.....................
.........................
......O..........^|^.....
.....\|/.........^|^.....
..................|......
.................\|/.....
.........................
.........................
....*....................
...\|/..............\@/..
.........................
..................*......
.......\@/.......\|/.....
...O.....................
..\|/.......*............
...........\|/...........
.........................
3 weeds at 5 costs 15
3 snails at 2 costs 6
4 stones at 1 costs 4
total cost 25

The output must be terminated by a line-break.
This is code-golf, may the shortest code win.
Additional test case
Edit: this used to contain Unicode, which isn't allowed in the flowerbed, far too modern. This has been rectified, sorry about that.
25 15 5
5 3 ..@..\\|//.\|/. overgrown_plants 3
5 3 @-o....|...\|/. semi-articulated_plant 4
3 2 .|.\@/ mutant_plants 5
1 1 $ dollars 0
1 1 # stones 1
.........................
........@................
....$..\|/...........@...
............|.......\|/..
...#.......\@/...........
.........................
.........................
......@.......@......@...
.....\|/....\\|//...\|/..
.............\|/.........
.#....................#..
.........$.......|.......
...\/.......\/..\@/..\/..
..\\//.....\\//.....\\//.
.........................

Expected Output:
.........................
........@................
.......\|/...........@...
....................\|/..
.........................
.........................
.........................
......@..............@...
.....\|/............\|/..
.........................
.........................
.........................
...\/.......\/.......\/..
..\\//.....\\//.....\\//.
.........................
1 overgrown_plants at 3 costs 3
0 semi-articulated_plants at 4 costs 0
2 mutant_plants at 5 costs 10
2 dollars at 0 costs 0
3 stones at 1 costs 3
total cost 16

May we assume the bounding box of each unwanted item is exact? That is, no border in the item's description is fully dots?

@JanDvorak yes, that seems a reasonable enough constraint. I'll add that to the question, and I'll borrow your wording on the presumption that you won't mind my doing so.

Will the snail be crawling to different direction as well? \@ and @/ for example.. Or are they bound to point eternally to west?

@SickDimension the unwanted items should only be matched precisely as they are described, distinct rotations and flips should not be matched. This does not preclude the possibility that a snail will crawl in the other direction, but no one is being paid to remove them in the example.

Perl - 636
There is definitely some more golfing that can be done. And probably better ways to do it too.
<>;while(<>){if(/ /){chomp;push@v,$_}else{$t.=$_}}for(@v){r(split/ /)}say$t.$y."total cost $u";sub r{my($e,$w,$c,$h,$z)=@_;($i,$f,$q,$d)=(1,0,0,"."x$e);@m=($c=~/($d)/g);@l=split/\n/,$t;while($i>0){($g,$j)=(1,0);for(0..$#l){if($j==0&&$l[$_]=~/^(.*?)\.\Q$m[$j]\E\./){$j++;$l="."x length$1}elsif($j<@m&&$l[$_]=~/^$l\.\Q$m[$j]\E\./){$j++}elsif($j>0){$l[$_-1]=~s!.\Q$m[$j-1]\E.!" ".$m[$j-1]=~s/\./ /gr." "!e;($j,$g)=(0,0)}if($j==@m){$k=$j;for($f=$_;$f>$_-$j;$f--){$k--;$o="."x length$m[$k];$l[$f]=~s/^($l)\.\Q$m[$k]\E\./$1.$o./}($g,$j)=(0,0);$q++}}if($g){$i--}}$t=join("\n",@l)."\n";$t=~s/ /./g;$p=$z*$q;$u+=$p;$y.="$q $h at $z costs $p\n"}

635 characters + 1 for -C flag to handle the euros.
If you have the input stored in input.txt you can run it with:
cat input.txt | perl -C -E'<>;while(<>){if(/ /){chomp;push@v,$_}else{$t.=$_}}for(@v){r(split/ /)}say$t.$y."total cost $u";sub r{my($e,$w,$c,$h,$z)=@_;($i,$f,$q,$d)=(1,0,0,"."x$e);@m=($c=~/($d)/g);@l=split/\n/,$t;while($i>0){($g,$j)=(1,0);for(0..$#l){if($j==0&&$l[$_]=~/^(.*?)\.\Q$m[$j]\E\./){$j++;$l="."x length$1}elsif($j<@m&&$l[$_]=~/^$l\.\Q$m[$j]\E\./){$j++}elsif($j>0){$l[$_-1]=~s!\Q$m[$j-1]\E!$m[$j-1]=~s/\./ /gr!e;($j,$g)=(0,0)}if($j==@m){$k=$j;for($f=$_;$f>$_-$j;$f--){$k--;$o="."x length$m[$k];$l[$f]=~s/^($l)\.\Q$m[$k]\E\./$1.$o./}($g,$j)=(0,0);$q++}}if($g){$i--}}$t=join("\n",@l)."\n";$t=~s/ /./g;$p=$z*$q;$u+=$p;$y.="$q $h at $z costs $p\n"}'

Here is the deparsed version. I went through and added some comments to help explain things. Maybe I'll go make the variable names more readable sometime. There may be some edge cases this doesn't work with but it works with the examples at least.
BEGIN { # These are the features we get with -C and -E flags
    $^H{'feature_unicode'} = q(1); # -C gives us unicode
    $^H{'feature_say'} = q(1); # -E gives us say to save 1 character from print
    $^H{'feature_state'} = q(1);
    $^H{'feature_switch'} = q(1);
}
<ARGV>; # throw away the first line
while (defined($_ = <ARGV>)) { # read the rest line by line
    if (/ /) { # if we found a space (the garden doesn't have spaces in it)
        chomp $_; # remove the newline
        push @v, $_; # add to our array
    }
    else { # else, we construct the garden
        $t .= $_;
    }
}
foreach $_ (@v) { # call the subroutine r by splitting our input lines into arguments
    r(split(/ /, $_, 0)); # the arguments would be like r(3,2,".R.\|/","rouge_flower",3)
}
say $t . $y . "total cost $u"; # print the cost at the end

# this subroutine removes weeds from the garden and counts them
sub r {
    BEGIN {
        $^H{'feature_unicode'} = q(1);
        $^H{'feature_say'} = q(1);
        $^H{'feature_state'} = q(1);
        $^H{'feature_switch'} = q(1);
    }
    my($e, $w, $c, $h, $z) = @_; # get our arguments
    ($i, $f, $q, $d) = (1, 0, 0, '.' x $e); # initialize some variables
    @m = $c =~ /($d)/g; # split a string like this .R.\|/ into .R. and \|/
    @l = split(?\n?, $t, 0); # split the garden into lines to process line by line
    while ($i > 0) {
        ($g, $j) = (1, 0);
        foreach $_ (0 .. $#l) { # go through the garden
            if ($j == 0 and $l[$_] =~ /^(.*?)\.\Q$m[$j]\E\./) { # this matches the top part of the weed. \Q and \E make it so the weed isn't intepreted as a regex. Capture the number of dots in front of it so we know where it is
                ++$j;
                $l = '.' x length($1); # this is how many dots we have
            }
            elsif ($j < @m and $l[$_] =~ /^$l\.\Q$m[$j]\E\./) { # capture the next line
                ++$j;
            }
            elsif ($j > 0) { # if we didn't match we have to reset
                $l[$_ - 1] =~ s[.\Q$m[$j - 1]\E.][' ' . $m[$j - 1] =~ s/\./ /rg . ' ';]e; # this line replaces the dots next to the weed and in the weed with spaces
                # to mark it since it didn't work but the top part matches
                # that way when we repeat we go to the next weed
                ($j, $g) = (0, 0);
            }
            if ($j == @m) { # the whole weed has been matched
                $k = $j;
                for ($f = $_; $f > $_ - $j; --$f) { # remove the weed backwards line by line
                    --$k;
                    $o = '.' x length($m[$k]);
                    $l[$f] =~ s/^($l)\.\Q$m[$k]\E\./$1.$o./;
                }
                ($g, $j) = (0, 0);
                ++$q;
            }
        }
        if ($g) {
            --$i; # all the weeds of this type are gone
        }
    }
    $t = join("\n", @l) . "\n"; # join the garden lines back together
    $t =~ s/ /./g; # changes spaces to dots
    $p = $z * $q; # calculate cost
    $u += $p; # add to sum
    $y .= "$q $h at $z costs $p\n"; #get message
}

Feel free to suggest improvements!

Nice work, and I'm afraid I have sinned, I did specify that the flowerbed would be ASCII, and then got all excited and put Unicode in the example - I will change the example so that it's just ASCII, sorry for making work for you.

@VisualMelon it was interesting to learn how to get a one-liner to work with unicode. I didn't know about the -C flag before this. I'll leave it in there to be compatible anyway since it is only a 1 character difference.

Python 3, 459 bytes
    from re import*
E=input()
W,H,C=map(int,E[0].split())
B,T,O='\n'.join(E[~H:]),0,''
for L in E[1:~H]:
 w,h,s,n,c=L.split();w,h,c=map(int,(w,h,c));r,t='.'*(w+2),0;a=[r]+['.%s.'%s[i:i+w]for i in range(0,w*h,w)]+[r]
 for L in['(%s)'%'\\n'.join('.{%d})%s(.*'%(i,escape(b))for b in a)for i in range(W)]:t+=len(findall(L,B));B=sub(L,r.join('\\%d'%b for b in range(1,h+4)),B,MULTILINE)
 O+='%d %s at %d costs %d\n'%(t,n,c,t*c);T+=t*c
print(B+O+'total cost',T)

Assumes the input will be given as a list of strings.

I like the ~H trick; I can't test this now, but I'll try to do so later today.

I can't seem to get this to run correctly (ValueError: not enough values to unpack (expected 3, got 1), python 3.6.6); can you provide a TIO link or some description on how to run it. I think it might be bending the rules by assuming the input is all on one line, but I wasn't entirely clear about that in the question so I won't complain.

@VisualMelon - bah, I've probably copy/pasta'd something incorrectly. I can't get to TIO at work, so I'll check my work and post a link later today.