This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Java range operator?  RSS feed

 
Bartender
Posts: 10759
68
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Aleksey Vladimirovich wrote:My God, now I got how wrong I was
...
I thought solving of this problem by Winston's approach would request some fancy and very slow algorithm, but I was so wrong. Results talk for themselves.
Thank you guys for steering me to the right solution and your patience! You rock, guys!


And isn't it much more fun when you work out the solution for yourself? That's why we DON'T just hand out answers here.

And well done.

Winston
 
Marshal
Posts: 64159
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

fred rosenberger wrote: . . . I haven't done the math to figure out the complexity of each algorithm, . . .

Iterating the series of numbers to find their prime factors, multiplied by time to multiply those factors. At worst, quadratic, but for large numbers it may approach nlogn complexity.
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!