Python Forum
first k non prime numbers print
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
first k non prime numbers print
#1
I have a hackkerank coding challenge to print first n non prime numbers, i have the working code but the problem is that they have a locked code which prints numbers from 1 to n along with the output, in order to pass the test i need to print only the non prime numbers not 1...n numbers along with it. I cant comment the printing part of 1...n as it is blocked. please let me know the idea to print only 1st n non prime numbers

1
[1]
[1]
2
[1, 4]
[1, 4]
3
[1, 4, 6]
[1, 4, 6]
4
[1, 4, 6, 8]
5
[1, 4, 6, 8, 9]
6
[1, 4, 6, 8, 9, 10]
[1, 4, 6, 8, 9, 10]
7
[1, 4, 6, 8, 9, 10, 12]
[1, 4, 6, 8, 9, 10, 12]
8
[1, 4, 6, 8, 9, 10, 12, 14]
9
[1, 4, 6, 8, 9, 10, 12, 14, 15]
10
[1, 4, 6, 8, 9, 10, 12, 14, 15, 16]
[1, 4, 6, 8, 9, 10, 12, 14, 15, 16]
11
[1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18]
[1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18]
12
[1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20] my output

expected output
1
4
6
8
9
10
12
14
15
16
18
20
Reply


Messages In This Thread
first k non prime numbers print - by bsrohith - Mar-01-2019, 07:44 AM
RE: first k non prime numbers print - by ichabod801 - Mar-01-2019, 04:35 PM
RE: first k non prime numbers print - by bsrohith - Mar-01-2019, 04:57 PM
RE: first k non prime numbers print - by ichabod801 - Mar-01-2019, 05:56 PM
RE: first k non prime numbers print - by bsrohith - Mar-01-2019, 06:41 PM
RE: first k non prime numbers print - by arycloud - Jun-20-2019, 08:40 AM
RE: first k non prime numbers print - by ichabod801 - Jun-20-2019, 10:31 AM
RE: first k non prime numbers print - by arycloud - Jun-20-2019, 10:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  prime numbers with iterator and generator cametan_001 8 1,926 Dec-17-2022, 02:41 PM
Last Post: cametan_001
  prime numbers astral_travel 28 3,779 Nov-08-2022, 09:23 PM
Last Post: astral_travel
  Print max numbers in a list jimmoriarty 1 2,177 Sep-25-2020, 07:29 AM
Last Post: DPaul
  Is there a way i print odd and even numbers separately? spalisetty06 5 2,764 Jul-21-2020, 06:48 PM
Last Post: spalisetty06
  Supposed to print out even numbers DallasPCMan 4 1,996 May-21-2020, 05:50 PM
Last Post: ndc85430
  Return prime numbers from range krzyfigh 2 1,946 Apr-20-2020, 08:08 PM
Last Post: krzyfigh
  Prime numbers Anderi02 1 1,990 Oct-13-2019, 04:49 PM
Last Post: ichabod801
  first k non-prime numbers arycloud 11 7,365 Jul-09-2019, 02:19 PM
Last Post: abhi19935
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,765 May-09-2019, 12:19 PM
Last Post: Pleiades
  Why can't I print numbers in Python? skrivver99 2 2,807 Nov-04-2018, 09:47 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020