Go Down

Topic: Arduino generating prime numbers (Read 30427 times) previous topic - next topic

nickgammon



No I didn't, the library basically uses the standard number.c file which I found somewhere.

I thought you said you modified that library for Arduino.


I took the standard number.c file and added a class wrapper around it so you didn't have to muck around with malloc and free all over the place. So the low-level computations are the same.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

nickgammon

Code: [Select]
#include "Pseudoprimes.h";


Where is this file?
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

tmd3


"Pseudoprimes.h" ... Where is this file?


The text at reply #87, where the latest version of the sketch is attached, says that the included file - Pseudoprimes.h - still slumbers at reply #70.  But it didn't mean to say that; it meant to say it was attached to some other reply, since it's not at #70, and it was at reply #69 last time I saw it.

Fixed #87; attached a copy of sketch and included file here.

nickgammon

Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

NiceAntoine

Estimated Nick Gammon,

I LOVE prime numbers. In order to make the arduino works faster, I would like to program a prime number generating routine (just for fun purpose) using someting that make the arduino run faster.

Is there a way to do it in C? I mean a simple way, to program the arduino in C language to make it run faster calculus programs?
After many days of research, I did not found a tutorial clear enough. I even turning myself to PIC ,as there is lots of tutorial to program those on C with a 9$ programmer.

However, I think that with a FTDI breakout, a direct C programming should be easy.

Thank for helping me.
PS: I just love this project qnd the porting for big numbers!!!

MarkT

[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

encrypted_toast

How would you be able to generate prime numbers with the push of a button using an impulse counter?

SimonAllen

Ok.  So I am late to the party  I have cobbled this together but have all 8 LEDs fully lit including the decimal points.  It could be that I have a wrong connection

I have connected

VCC to 5V
GRD to GRD
DIN to pin 12
CS to pin 10 and
CLK to pin 13

If that is all good can anyone suggest where I have strayed?


SimonAllen

#98
Sep 10, 2017, 12:13 am Last Edit: Sep 10, 2017, 10:07 pm by SimonAllen
Ok.

I think I have figured it out

I had

VCC to 5V
GRD to GRD
DIN to pin 12
CS to pin 10 and
CLK to pin 13

I have changed it to

VCC to 5V
GRD to GRD
DIN to pin 11
CS to pin 10 and
CLK to pin 13

and now it is counting primes.

Go Up