mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

science_man_88 2010-12-01 18:02

[QUOTE=CRGreathouse;239504]I can't quite follow you, but
[code]n=0;
while(1,
print1(n++);
if(n>9, break);
print1(", ")
);[/code]
does the trick.[/QUOTE]


Wonder how fast we could finish off the list? You know most of them by the sounds of it. I'm still a little stumped on how to fix my rle script but I know ( and ) shouldn't be used to code something with. By the looks of it and I need ways to check for control characters,spaces and numbers that appear out of nowhere
in the strings but aren't part of the count of characters) maybe a Vec, and a scan of type will do but maybe not. I'm so stupid maybe tab in between would help lol.

science_man_88 2010-12-01 18:15

if something can be done to files in the file system root:

[url]http://rosettacode.org/wiki/File_size[/url] the hard part to this one that must have landed it in the too hard category must be how to read the original given file size to compare something with.

science_man_88 2010-12-01 18:38

[url]http://rosettacode.org/wiki/Pascal's_triangle/Puzzle[/url]

Doesn't sound hard in one sense.

solve:
[QUOTE]
[CENTER] [ 151]
[ ][ ]
[40][ ][ ]
[ ][ ][ ][ ]
[ X][11][ Y][ 4][ Z][/CENTER][/QUOTE]

first piece I can gather is x+y+22 = 40;so x+y=18 this is a fact to check for; also once a pair of x and y =18; also x+2y+z+30 = 151; so x+2y+z = 121; another fact to check for when going through z values.

science_man_88 2010-12-01 18:44

[CODE]for(x=0,18,for(y=0,18,if(x+y=18,for(z=1,103,if((x+2*y+z)==121,print(x","y","z);break(3))))))[/CODE]

First one it found was 0,18,85 . It never says the program has to use only the data given, I used what I could gather.

science_man_88 2010-12-01 19:45

[QUOTE=science_man_88;239513][CODE]for(x=0,18,for(y=0,18,if(x+y=18,for(z=1,103,if((x+2*y+z)==121,print(x","y","z);break(3))))))[/CODE]

First one it found was 0,18,85 . It never says the program has to use only the data given, I used what I could gather.[/QUOTE]

oops forgot y=x+z but that doesn't work I've messed up

science_man_88 2010-12-01 20:25

I've determined y=13 by:


[ 6y+x+z+4a[2]+4a[4]= 7y +4a[2]+4a[4]]
[3y+x+37 ][3y+z+23]
[40=x+y+22][ 2y+15][ y+z+8 ]
[ x+11 ][y+11 ][y+4 ][z+4 ]
[ X][11][ Y][ 4][ Z]

if a = [] bottom row


for this sized triangle we see in this case 151-(44+16) = 91 ; 91/7 =13 y=13
40-13-22 =x = 5; 13-5=z=8;

however I now know how to solve it in this case.

science_man_88 2010-12-01 20:47

[CODE] Pascals_triangle_puzzle(topvalue=151,leftsidevalue=40,bottomvalue1=11,bottomvalue2=4) = {
y=(topvalue-(4*(bottomvalue1+bottomvalue2)))/7;
x=leftsidevalue-(y+2*bottomvalue1);
z=y-x;
print(x","y","z); }[/CODE]

This easy enough ? I might try to make one for any size. just have to figure out the patterns lol.

3.14159 2010-12-01 23:24

I figured out how to falsify factoring a large number (somewhat);

[code][866876601688257388041953428681474799611455578456879011971315052706094788178469895182220494116473202297231530219967803566778120639 528365543601153323389150907773258262552994601295053933845142213535320241754514748728875053183803012869853716977772216817067444377]

[361704130063529693429159107448019863732305480622816041454555619831169499041663864963068219490947259594777674878198147873998732309 326729818580681541350657067987755793696856969106820654842683490163988042729198926945304899046855890448333533668661395285070725039][/code]

Which is.. [code]866876601688257388041953428681474799611455578456879011971315052706094788178469895182220494116473202297231530219967803566778120639[sup]528365543601153323389150907773258262552994601295053933845142213535320241754514748728875053183803012869853716977772216817067444377[/sup] * 361704130063529693429159107448019863732305480622816041454555619831169499041663864963068219490947259594777674878198147873998732309[sup]326729818580681541350657067987755793696856969106820654842683490163988042729198926945304899046855890448333533668661395285070725039[/sup][/code]

science_man_88 2010-12-01 23:26

[QUOTE=3.14159;239539]I figured out how to falsify factoring a large number (somewhat);

[code][866876601688257388041953428681474799611455578456879011971315052706094788178469895182220494116473202297231530219967803566778120639 528365543601153323389150907773258262552994601295053933845142213535320241754514748728875053183803012869853716977772216817067444377]

[361704130063529693429159107448019863732305480622816041454555619831169499041663864963068219490947259594777674878198147873998732309 326729818580681541350657067987755793696856969106820654842683490163988042729198926945304899046855890448333533668661395285070725039][/code]

Which is.. [code]866876601688257388041953428681474799611455578456879011971315052706094788178469895182220494116473202297231530219967803566778120639[sup]528365543601153323389150907773258262552994601295053933845142213535320241754514748728875053183803012869853716977772216817067444377[/sup] * 361704130063529693429159107448019863732305480622816041454555619831169499041663864963068219490947259594777674878198147873998732309[sup]326729818580681541350657067987755793696856969106820654842683490163988042729198926945304899046855890448333533668661395285070725039[/sup][/code][/QUOTE]

finally Pi is back lol.

3.14159 2010-12-01 23:31

[QUOTE=science_man_88;239540]finally Pi is back lol.[/QUOTE]

Thanks. I get + 1 years added to my current age today.

CRGreathouse 2010-12-01 23:41

[QUOTE=science_man_88;239506]so in other words if(string==type(0) ||string==type(1/2), print("this string is numerical")) would work ?[/QUOTE]

No.

if(type(string) == "t_STR", print("It's a string."))

[QUOTE=science_man_88;239506]Though I haven't covered floating point types.[/QUOTE]

t_REAL and t_COMPLEX.


All times are UTC. The time now is 23:10.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.