File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programming Diversions and the fly likes Sequence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Sequence" Watch "Sequence" New topic
Author

Sequence

Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
This one is quite easy.
Give the sequence of numbers such that any two adjacent numbers are coprime(relatively prime) and when bigger divided by smaller ,remainder is number adjacent to smaller one.(means smaller number is between 'bigger one' and remainder)


MH
Sonny Pondrom
Ranch Hand

Joined: Jun 05, 2001
Posts: 128
Is this correct looking at "b" and "c"
a b c d

a = remainder
b = small #
c = large #
Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
Yes
Ryan Smith
Ranch Hand

Joined: Jun 29, 2004
Posts: 40
1, 2, 3, 5, 13, 31, 74....ad infinitum
Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
{
13, 31, 74
}
74%31 = 12
Actually the sequence consists of Fibonacci numbers.
Ryan Smith
Ranch Hand

Joined: Jun 29, 2004
Posts: 40
Haha I skipped some didn't I! Sorry that's what I meant
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Sequence