You are not logged in.
Pages: 1
There is some logic behind this sequence
2,3,4,5,6,6,8,8,9,10,12,12,14,14,15,16,18,18,20,20..
But I cant find what it is.. Please help me..
Actually, i have to write a c program to print those numbers.. But, I cant guess, in what basis, these numbers are arranged..
Offline
Maybe: after 10, print the next number if it is prime?
"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense" - Buddha?
"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."
Offline
U mean, after 10.. the numbers 12,14,15 are all prime??? No, its not possible :'(
Offline
I meant
11 -> 12
13 -> 14
17 -> 18
19 -> 20
etc.
"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense" - Buddha?
"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."
Offline
Here's my logic, but I don't know C and so I can't help there.
Edit: Hi gAr, I just realised that our methods are much alike - other than my reference to multiples of 6.
x=1
1. Increment x by 1 and print x unless x is a multiple-digit prime for which Mod[x,6]=5.
2. If Mod[x,6]=0, print x again and x+2 twice; but if not, GoTo 1.
3. x = x + 2
4. GoTo 1.
I think my pseudo code works...
Last edited by phrontister (2014-02-23 09:52:18)
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Hi,
Here's my code in Mathematica. The sequence program works, but I don't know how to convert the output column into a one-line row such as in post #1.
Last edited by phrontister (2014-02-24 10:06:27)
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Hi phrontister,
Nice! I think you may collect the terms and flatten it.
"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense" - Buddha?
"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."
Offline
Hi gAr,
Thanks...I'd already tried collecting the terms with Table and some other commands, but nothing worked until I replaced Print with Sow and Reap. Then I used Last to remove "Null" from the front of the list and Flatten to leave just one set of external curly brackets (removing that last set seems to need too much extra code for no real value other than visual, and so I left the brackets there).
Last edited by phrontister (2014-02-23 23:33:11)
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Pages: 1