Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7440937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:55:46+00:00 2026-05-29T10:55:46+00:00

C-number is an integer n > 1 such that (b^n)mod n = b for

  • 0

“C-number” is an integer n > 1 such that (b^n)mod n = b for all integers 1

Basically I have to create a program to run through about 2000 integers(1-2000), and have it satisfy the C-number condition, and then also check to see if it is NOT a prime number. I can’t seem to get the loop working correctly.
I have a program that creates a list of non primes, and a working program that if I input a number, it will return me that number if it is a c-number, if not I’ll get false returned.

I want it to just check numbers 1-2000 rather than just the one number I inputted, and then also check against the list of non prime numbers.

Here’s my code:

import numpy
def primesfrom2to(n):
""" Input n>=6, Returns a array of primes, 2 <= p < n """
sieve = numpy.ones(n/3 + (n%6==2), dtype=numpy.bool)
for i in xrange(1,int(n**0.5)/3+1):
    if sieve[i]:
        k=3*i+1|1
        sieve[       k*k/3     ::2*k] = False
        sieve[k*(k-2*(i&1)+4)/3::2*k] = False
    return numpy.r_[2,3,((3*numpy.nonzero(sieve)[0][1:]+1)|1)]

num=range(600)
mylist =primesfrom2to(600)
s = [item for item in num if item not in mylist]
a=[]
d=[]        
from math import *
def numc(n):
    for a in range(1,n):

            c= a**n
        d=c%n       
    if a == d:
        return n
    else:
        return False
print numc(561)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:55:46+00:00Added an answer on May 29, 2026 at 10:55 am

    You probably need to just fix the indentation (needs fixing in a lot of places):

    def numc(n):
    for a in range(1,n):
        c= a**n
        d=c%n  
    

    Python is pretty much written through indentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 'price' variable that contains some integer number from a MySQL database.
I have a large number of user IDs (integers), potentially millions. These users all
I want to create this simple division program.But the problem is that the divisors
Let f(N) be the number of points with integer coordinates that are on a
I have oracle backend for my application. The schema is designed such that I
Is there an efficient algorithm to compute the smallest integer N such that N!
If I have a integer number n , how can I find the next
Suppose I have a table of customers: CREATE TABLE customers ( customer_number INTEGER, customer_name
I want to create an object that acts as a specific class, such as
Ok basically I'm writing a program that takes in two directories and processes them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.