Click here to Skip to main content
15,895,370 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Blum Blum Shub Pin
Richard MacCutchan5-Oct-20 8:48
mveRichard MacCutchan5-Oct-20 8:48 
GeneralRe: Blum Blum Shub Pin
Member 149564755-Oct-20 8:57
Member 149564755-Oct-20 8:57 
GeneralRe: Blum Blum Shub Pin
Richard MacCutchan5-Oct-20 9:02
mveRichard MacCutchan5-Oct-20 9:02 
GeneralRe: Blum Blum Shub Pin
Member 149564755-Oct-20 9:08
Member 149564755-Oct-20 9:08 
GeneralRe: Blum Blum Shub Pin
Richard MacCutchan5-Oct-20 9:23
mveRichard MacCutchan5-Oct-20 9:23 
AnswerRe: Blum Blum Shub Pin
ZurdoDev5-Oct-20 10:15
professionalZurdoDev5-Oct-20 10:15 
AnswerRe: Blum Blum Shub Pin
David Crow6-Oct-20 2:39
David Crow6-Oct-20 2:39 
GeneralRe: Blum Blum Shub Pin
Member 149564756-Oct-20 10:32
Member 149564756-Oct-20 10:32 
Okay , this is the code that i managed to do :
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*BLUM BLUM SHUB*/

int main()
{

  const int p = 30000000091;
  const int q = 40000000003;
  int N ;
  scanf("%i", &N);
  const unsigned long long int s = 1200000003730000000273;
  unsigned int i,M,x[N];
  time_t t;
  srand((unsigned) time(&t));


  M=p*q;

  i=0;
  x[0]=s;
  for(i=1;i<=N;i++){
                    x[i]=(x[i-1]*x[i-1])%M;
                   }
  for(i=1;i<=N;i++){
                    printf(" x[%d] = %d\n",i,x[i]);
                    }

  system("PAUSE");
  return 0;
}


I have some issues with it , first it's that i need to add from console the biggest number D and i dont know how to put it in as now it's generating numbers without upper limit . Also can anyone tell me how to fix the code as it generates the same numbers at some intervals , if you have other remarks on how to make it better tell me please . ThanksSmile | :)
GeneralRe: Blum Blum Shub Pin
Richard Andrew x646-Oct-20 10:45
professionalRichard Andrew x646-Oct-20 10:45 
SuggestionRe: Blum Blum Shub Pin
David Crow6-Oct-20 16:05
David Crow6-Oct-20 16:05 
GeneralRe: Blum Blum Shub Pin
Member 149564757-Oct-20 7:13
Member 149564757-Oct-20 7:13 
AnswerRe: Blum Blum Shub Pin
David Crow7-Oct-20 7:31
David Crow7-Oct-20 7:31 
GeneralRe: Blum Blum Shub Pin
Member 149564757-Oct-20 7:39
Member 149564757-Oct-20 7:39 
GeneralRe: Blum Blum Shub Pin
David Crow7-Oct-20 7:55
David Crow7-Oct-20 7:55 
AnswerRe: Blum Blum Shub Pin
Member 149564758-Oct-20 1:36
Member 149564758-Oct-20 1:36 
GeneralRe: Blum Blum Shub Pin
Richard MacCutchan8-Oct-20 2:27
mveRichard MacCutchan8-Oct-20 2:27 
QuestionWritePrinter Fails to Print on Inkjet Printer Pin
sandford_j29-Sep-20 6:52
professionalsandford_j29-Sep-20 6:52 
QuestionRe: WritePrinter Fails to Print on Inkjet Printer Pin
David Crow29-Sep-20 16:44
David Crow29-Sep-20 16:44 
AnswerRe: WritePrinter Fails to Print on Inkjet Printer Pin
sandford_j29-Sep-20 22:16
professionalsandford_j29-Sep-20 22:16 
QuestionRe: WritePrinter Fails to Print on Inkjet Printer Pin
David Crow30-Sep-20 2:01
David Crow30-Sep-20 2:01 
AnswerRe: WritePrinter Fails to Print on Inkjet Printer Pin
sandford_j30-Sep-20 4:54
professionalsandford_j30-Sep-20 4:54 
AnswerRe: WritePrinter Fails to Print on Inkjet Printer Pin
Gerry Schmitz29-Sep-20 18:33
mveGerry Schmitz29-Sep-20 18:33 
GeneralRe: WritePrinter Fails to Print on Inkjet Printer Pin
sandford_j29-Sep-20 22:23
professionalsandford_j29-Sep-20 22:23 
AnswerRe: WritePrinter Fails to Print on Inkjet Printer Pin
mo149230-Sep-20 8:55
mo149230-Sep-20 8:55 
GeneralRe: WritePrinter Fails to Print on Inkjet Printer Pin
sandford_j30-Sep-20 12:05
professionalsandford_j30-Sep-20 12:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.