Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

## #1 2013-07-07 02:18:53

anonimnystefy
Real Member

Offline

### Help with M

Hi;

How would you find the 1000th prime with M if there was no Prime, and there was only PrimeQ?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #2 2013-07-07 02:36:06

bobbym

Online

### Re: Help with M

You need the exact 1000th?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #3 2013-07-07 02:38:20

anonimnystefy
Real Member

Offline

### Re: Help with M

Yeah.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #4 2013-07-07 02:39:30

bobbym

Online

### Re: Help with M

Then ye will have to loop through them counting as ye go.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #5 2013-07-07 02:44:17

anonimnystefy
Real Member

Offline

### Re: Help with M

That is the only way?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #6 2013-07-07 02:47:26

bobbym

Online

### Re: Help with M

As you know there is no known formula for generating all the primes in order. So how else? The only trick available is how you iterate to the answer.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #7 2013-07-07 02:49:49

anonimnystefy
Real Member

Offline

### Re: Help with M

But, say you do have the PrimeQ function. Is it possible then to generate it somehow?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #8 2013-07-07 02:51:37

bobbym

Online

### Re: Help with M

PrimeQ[n] tests n for primality by using Miller Rabin. It does not generate primes.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #9 2013-07-07 02:58:01

anonimnystefy
Real Member

Offline

### Re: Help with M

I know. The thing is that it is not exactly primes I am interested in, but rather Harshad numbers in base 5.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #10 2013-07-07 02:59:13

bobbym

Online

### Re: Help with M

What do you want to do with them?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #11 2013-07-07 02:59:42

anonimnystefy
Real Member

Offline

### Re: Help with M

I want to find the 1000th Harshad number in base 5.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #12 2013-07-07 03:03:54

bobbym

Online

### Re: Help with M

Do you have a small test list?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #13 2013-07-07 03:08:55

anonimnystefy
Real Member

Offline

### Re: Help with M

What kind of test list?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #14 2013-07-07 03:15:38

bobbym

Online

### Re: Help with M

The first few Harshad numbers in base 5 of course.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #15 2013-07-07 03:35:02

anonimnystefy
Real Member

Offline

### Re: Help with M

These should be correct:

{1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 18, 20, 24, 25, 26, 27, 28, 30, 32, 36, 40, 42, 45, 48, 50, 51, 52, 54, 56, 60, 63, 64, 65, 66, 72, 75, 76, 78, 80, 85, 88, 90, 91, 96, 99, 100}

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #16 2013-07-07 03:38:48

bobbym

Online

### Re: Help with M

#### Code:

```harshad[n_] := Mod[n, Plus @@ IntegerDigits[n, 5]] == 0;

Try that on a bigger list.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #17 2013-07-07 03:40:08

anonimnystefy
Real Member

Offline

### Re: Help with M

I know how to generate them. I do not know how to get the nth one.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #18 2013-07-07 03:43:10

bobbym

Online

### Re: Help with M

Is there a formula for the nth Harshad humber in any base?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #19 2013-07-07 03:45:15

anonimnystefy
Real Member

Offline

### Re: Help with M

I do not think so. That is why asked for the primes.

If I knew of a way to implement Prime using PrimeQ, it would be easy to implement Harshad using HarshadQ.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #20 2013-07-07 03:49:11

bobbym

Online

### Re: Help with M

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #21 2013-07-07 03:50:48

anonimnystefy
Real Member

Offline

### Re: Help with M

#### Code:

`HarshadQ[x_, b_] := Mod[x, Plus @@ IntegerDigits[x, b]] == 0`

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #22 2013-07-07 03:58:12

bobbym

Online

### Re: Help with M

As far as I know there is no other way then checking a subset of the integers using PrimeQ.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #23 2013-07-07 04:04:15

anonimnystefy
Real Member

Offline

### Re: Help with M

Either that or a loop.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #24 2013-07-07 04:06:30

bobbym

Online

### Re: Help with M

You could cut down the number that you would have to test. or you could download a list of primes. Or you could generate the list yourself. Then you would only have access them by index number.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

## #25 2013-07-07 04:10:45

anonimnystefy
Real Member

Offline

### Re: Help with M

But, the problem is that it does not extend to other kinds of numbers. As I said, I don't need the nth prime concretely.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment