2D-key 0011->0011

000 0 Do
001 1 Re
011 2 Mi
111 3 Re
101 2

(1*sqrt(0)+1*sqrt(1)+2*sqrt(2)+1*sqrt(3))*2/4=pi

3D-key 00010111->00011101

0000 0 Do
0001 1 Mi
0101 2 Re
0111 3 Mi
0011 2 Fa
1011 3 Re
1001 2 Mi
1101 3 Re
1111 4

(1*sqrt(0)+1*sqrt(1)+3*sqrt(2)+3*sqrt(3)+1*sqrt(4))*2/8=pi

5D-key 00000101100100011101010011011111->00000110111110010100111010110001

000000 0 Do
000001 1 Mi
000101 2 Re
000111 3 So
010111 4 Fa
011111 5 Mi
011011 4 Re
011001 3 So
001001 2 Do
001000 1 Mi
001100 2 Fa
000100 1 So
010100 2 Re
010110 3 Mi
010010 2 Fa
011010 3 So
001010 2 La
101010 3 Fa
100010 2 So
110010 3 Re
110000 2 Mi
110100 3 Fa
111100 4 So
101100 3 Re
101110 4 La
001110 3 Fa
000110 2 Mi
000010 1 Re
000000 0 So
010000 1 Fa
011000 2 Mi
011100 3 Re
011110 4

(2*sqrt(0)+5*sqrt(1)+10*sqrt(2)+10*sqrt(3)+5*sqrt(4)+1*sqrt(5))*2/31=pi
That's fantastic and all, but would you mind explaining aspects of the equation? I'm not familiar with the loop and don't know what I'm looking at.
comicIDIOT

I did not understand why this is so. Maybe it's the engineers know Smile
I'm confused... What is this topic for?
player1537

Topic for scientific researchers. Constant PI=3,141....
Err, okay. You should introduce yourself in this topic: http://cemete.ch/4925 (I don't understand this topic at all :/)
You need to give us more details about your entire post.
So, is this some kind of equation to calculate pi?
merthsoft

Delphi programm code for search this loops

Code:

unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, jpeg, ExtCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Memo1: TMemo;
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    procedure FormCreate(Sender: TObject);
    function DS(dx:string):string;
    procedure Button1Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  xy:array[0..100,0..1] of longint;
  qc:array[0..16] of longint;
  r,i,n,n2:longint;
  x1,y1,x2,y2,x0,y0:real;
  abacaba,abc,sx: string;
 x,gc: array[0..2048*64] of longint;
 m,pm: array[0..2048*64] of longint;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
 i:=0;
 r:=0;
end;

function TForm1.DS(dx:string):string;
var i,l,t,c,j,k,n,n2,r,q,max,pc,mc,f,gf:longint;
  lx,cx:string;
begin
 max:=8192*2;
 l:=Length(dx)-1;
 sx:=dx;
 dx:=dx+dx;
 n2:=1;
 n:=0;
for q:=0 to max-1 do
begin
 r:=0;
 n2:=n2*2;
 n:=n+1;
 if l>=(n-1) then
 begin
 for i:=0 to n2-1 do m[i]:=0;
 for i:=0 to l do
 begin
  t:=0;
  for j:=0 to n-1 do
  begin
   lx:=dx[1+i+j];
   if lx<>'x' then t:=t or ((StrToInt(dx[1+i+j]) and 1) shl (n-j-1)) else f:=1;
  end;
  m[t]:=1;
 end;
 for i:=0 to n2-1 do
 begin
  if (m[i]=1) then
  begin
  r:=r+1;
  end;
 end;
 end;
 if n>max then break;
 if n2<>r then break;
end;

r:=1;
for i:=0 to n-2 do r:=r*2;
mc:=0;
for q:=0 to l+1 do
begin
 for i:=0 to 2*r-1 do
 begin
  m[i]:=-1;
  pm[i]:=-1;
 end;
 cx:='';
for i:=0 to r-1 do
begin
 t:=0;
 f:=1;
 for j:=0 to n-2 do
 begin
  lx:=dx[1+(q+(i+(j mod r)) mod r) mod (l+1)];
  f:=0;
  if lx<>'x' then t:=t or ((StrToInt(lx) and 1) shl ((n-j-2))) else f:=1;
 end;
 if f=0 then m[t]:=1 else m[t]:=-1;
end;
 pc:=0;
 for i:=0 to r-1 do
 begin
  if (m[i]=1) then
  begin
   pc:=pc+1;
  end;
 end;
 if pc=r then
 begin
 cx:='';
 for i:=0 to r-1 do
 begin
  t:=0;
  f:=1;
  for j:=0 to n-2 do
  begin
   lx:=dx[1+(q+(i+(j mod r)) mod r) mod (l+1)];
   t:=t or ((StrToInt(lx) and 1) shl ((n-j-2)));
  end;
  f:=1+((q+i+n-1) mod r) mod (r);
  cx:=dx[f];
  pm[t]:=StrToInt(cx);
 end;

  for j:=0 to r-1 do
  begin
   if pm[j]=0 then
   begin
    dx[1+(q+j) mod (l+1)]:='0';
    sx[1+(q+j) mod (l+1)]:='x';
   end else
   begin
    dx[1+(q+j) mod (l+1)]:='1';
    sx[1+(q+j) mod (l+1)]:='x';
   end;
  end;
  mc:=mc+1;
  break;
 end;
 if n>max then break;
end;
for j:=0 to r-1 do
begin
 q:=(j shr 1) xor j;
 sx[1+(j) mod (l+1)]:=dx[1+(q) mod (l+1)];
end;
 SetLength(dx,Round(l+1));
 SetLength(sx,Round(l+1));
 Memo1.Lines.Add(dx+' '+sx+' '+IntToStr(n-1));
 DS:=sx;
end;

procedure TForm1.Button1Click(Sender: TObject);
var pi,mpi,cx,cy,cp,bx,by:real;
 f,i,j,k,l,r,n,n2,m,c,c0,p,q0,q1,z,cnt,v,w:longint;
 qx,s,ts,graycube,st,stp,ms,rythm,new:string;
 t,q,max,pc,mc,nc,ps:longint;
 bf,mbf:int64;
 tm1,tm2:longint;
function HD(a,b,n:longint):longint;
var i,p:longint;
begin
 p:=0;
 for i:=1 to n do
 begin
  if (((a and 1) xor (b and 1))=1) then p:=p+1;
  a:=a shr 1;
  b:=b shr 1;
 end;
 HD:=p;
end;

procedure GetRuler(ds:string;n,n2:longint);
var Hx:string;
   i,max,j,e,p,q,t,f,u,z:longint;
   st,rs:string;
   s:string;
   ruler,x,y,c,rz,mt:array[0..1024] of longint;
begin
for z:=0 to 128 do
begin
 ruler[z]:=-1;
 x[z]:=-1;
 y[z]:=-1;
end;
 max:=n2;
 st:=ds;
 for i:=0 to max-1 do
 begin
  p:=0;
  for j:=0 to n-1 do
  begin
   if (st[i+j+1]='1') then p:=p or 1;
   p:=p shl 1;
  end;
  x[i]:=p shr 1;
 end;
 t:=0;
 p:=0;
 f:=0;
 ruler[0]:=0;
 y[0]:=1;
  while (f=0) do
  begin
   z:=t;
   j:=0;
   while (j<max) do
   begin
    if (y[j]=-1) then
    begin
     p:=x[j];
     q:=0;
     i:=0;
     if t>(n-1) then u:=n-1 else u:=t+1;
     while (i<u) do
     begin
      if (HD(p,ruler[(t-i)],n)=(i+1)) then
      begin
       q:=q+1;
      end;
      i:=i+1;
      if q=u then break;
     end;
     if q=u then
     begin
      t:=t+1;
      ruler[t]:=x[j];
      y[j]:=1;
      f:=0;
      break;
     end;
    end;
    j:=(j+1);
   end;
  if t=z then break;
 end;
 if t=max-1 then
 begin
  st:='';
  st:=st+ds;
  for i:=0 to max-1 do st:=st+' '+IntToStr(ruler[i]);
  Memo1.Lines.Add(st);
 end;
end;

begin
 tm1:=GetTickCount();
 tm2:=0;
 mbf:=144115188075855872;
 bf:=0;
 pi:=3.1415926535897932384626433832795;
 mpi:=0;
 n:=StrToInt(Edit2.Text);
 n2:=1 shl n;//(long)pow(2,n);
 p:=0;
 z:=0;
 cnt:=0;
 s:=''; ts:='';
 for i:=0 to n2+n do begin if (i<n) then x[i]:=0 else x[i]:=0;end;
 i:=n;
 while (i<n2+n-1+1) do begin
 v:=i;
  for j:=0 to i-n do begin
    f:=1;
    for k:=0 to n-1 do begin if (x[i+k-n+1]<>x[j+k]) then begin f:=0;break;end;end;
    if (f=1) then begin break;end;
  end;
  c:=1;
  if (f=1) then begin
    j:=i;
    while (j>=n) do begin
     c0:=x[j];
     x[j]:=(x[j]+c) mod 2;
     if (c0=1) then begin c:=1;j:=j-1;end else begin break;end;
    end;
    i:=j;
   end else begin
    i:=i+1;
   end;
//print
  if ((i=(n2+n-1)) and ((p mod 2)=0)) then begin
//s:=s+#13#10;
  for l:=0 to n2-1 do begin
   s:=s+IntToStr(x[l]);
  end;
//   s:=s+#13#10;
 GetRuler(s,n,n2);
 s:='';
// break; //for one print
 end;
 p:=p+1;
 if (i<n) then begin break; end;
end;
 s:='';
 tm2:=GetTickCount();
 Memo1.Lines.Add(IntToStr(Round(tm2-tm1)));
 Memo1.Lines.Add('end');
end;

procedure TForm1.Edit1Change(Sender: TObject);
var i,l,t,c,j,n,n2,r,q,max,pc,mc,f:longint;
  x,lx:string;
  cinx:array[0..32,0..32] of longint;
  m:array[0..65536] of longint;
begin
 x:='';
 x:=Edit1.Text;
 max:=16;
 l:=Length(x)-1;
 x:=x+x;
 n2:=1;
 n:=0;
 Label1.Caption:=IntToStr(l+1);
for q:=0 to max-1 do
begin
 r:=0;
 n2:=n2*2;
 n:=n+1;
 if l>=(n-1) then
 begin
 for i:=0 to n2-1 do m[i]:=0;
 for i:=0 to l do
 begin
  t:=0;
  for j:=0 to n-1 do
  begin
   t:=t or ((StrToInt(x[1+i+j]) and 1) shl (n-j-1));
  end;
  m[t]:=1;
 end;
 for i:=0 to n2-1 do
 begin
  if (m[i]=1) then
  begin
  r:=r+1;
  end;
 end;
 end;
 if n>max then break;
 if n2<>r then break;
end;
r:=1;
for i:=0 to n-2 do r:=r*2;

mc:=0;
for q:=0 to l+1 do
begin
 for i:=0 to 2*r-1 do m[i]:=-1;

for i:=0 to r-n+3 do
begin
 t:=0;
 f:=1;
 for j:=0 to n-2 do
 begin
  lx:=x[1+(q+(i+(j mod r)) mod r) mod (l+1)];
  f:=0;
  if lx<>'x' then t:=t or ((StrToInt(lx) and 1) shl ((n-j-2))) else f:=1;
 end;
 if f=0 then m[t]:=1 else m[t]:=-1;
// Memo1.Lines.Add(IntToStr(t));
end;
 pc:=0;
 for i:=0 to r-1 do
 begin
  if (m[i]=1) then
  begin
   pc:=pc+1;
  end;
 end;
 if pc=r then
 begin
  for j:=0 to r-1 do x[1+q+j]:='x';
  mc:=mc+1;
  //break;
 end;
 if n>max then break;
end;
 max:=n-1;
 if mc>max then max:=mc;
 Label1.Caption:=Label1.Caption+' '+IntToStr(n-1)+'*'+IntToStr(mc)+' max= '+IntToStr(max)+' ok. '+IntToStr(r)+'/'+IntToStr(n2);
end;

end.


Edit by Merth: Added code tags
souvik1997

Yes.
merthsoft

Application for research in machine vision. (OCR)
Are you just trying to find Dr Bruijn sequences? I made a program to do that, too:
http://www.cemetech.net/forum/viewtopic.php?t=5704
Please don't double post, edit your post instead if you want to add more content to it.
Heads up navigator: it's pretty bad practice to post code or code results in a forum post with no explanation or whatnot. It's even worse when you expect everyone to know what it is. It may not be your intention to seem trollish or nasty, but that's what it comes across as Wink

On a side note, welcome to cemetech, and I hope you enjoy your stay Smile and yes, double posts are a no-no here, but don't feel guilty about that, because 99% of new users do this too.

EDIT: also, what language is that in? From what I can tell it looks like Ada in 95 dialect. I know the government uses Ada a decent amount -- are you an engineer for the government? If so, awesome Smile if not, awesome because you use Ada.
He said it was Delphi, which is a sort of weird Pascal thing.
merthsoft wrote:
He said it was Delphi, which is a sort of weird Pascal thing.


Interesting, shame on me for skimming the important things. I just assumed it was Ada due to the begin...whatever blocks and the floating keywords.

Cool, never heard of Delphi before. Smile
FWIW, I didn't think he was trolling. I had thought he was a spambot, though.
Ashbad wrote:
merthsoft wrote:
He said it was Delphi, which is a sort of weird Pascal thing.


Interesting, shame on me for skimming the important things. I just assumed it was Ada due to the begin...whatever blocks and the floating keywords.

Cool, never heard of Delphi before. Smile

I've never heard of Delphi either <.< Navigator, sorry if I seem rude, but why do you have random numbers in the website field in your profile?
souvik1997

In my profile is really random. I wanted to quickly get this information to your users and programmers. Esli want, I'll spambots. : (

Hi, Ashbad (with Avatar Tiles)

About Delphi can be found here http://en.wikipedia.org/wiki/Object_Pascal
navigator wrote:
souvik1997

In my profile is really random. I wanted to quickly get this information to your users and programmers. Esli want, I'll spambots. : (

Hi, Ashbad (with Avatar Tiles)

Sonic the Hedgehog 2 classic 2D games on the sega. I'm sorry, that is now fashionable to make 3D games.
Present the researcher has no need of microscopes or telescopes, why should he see the individual pixels? this is a joke? possible.

About Delphi can be found here http://en.wikipedia.org/wiki/Object_Pascal

Umm, what? This post doesn't make any sense, and makes me think you are a spambot.
  
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement