From a2ceb2b99cecce0ab15932ecc9af89e0d971353b Mon Sep 17 00:00:00 2001 From: vijaygopalchilkuri Date: Fri, 21 Jun 2013 17:58:19 +0200 Subject: [PATCH] working problem 4 --- problem4/IRPF90_temp/Makefile | 12 ++++ problem4/IRPF90_temp/README.md | 7 +++ problem4/IRPF90_temp/irp_stack.irp.F90 | 38 ++++++++++++ problem4/IRPF90_temp/irp_stack.irp.o | Bin 0 -> 1704 bytes problem4/IRPF90_temp/irp_stack_mod.mod | 42 +++++++++++++ problem4/IRPF90_temp/irp_touches.irp.F90 | 3 + problem4/IRPF90_temp/irp_touches.irp.o | Bin 0 -> 1232 bytes problem4/IRPF90_temp/irpf90.make | 41 +++++++++++++ problem4/IRPF90_temp/irpf90_entities | 0 problem4/IRPF90_temp/is_palindrome.irp.F90 | 33 ++++++++++ problem4/IRPF90_temp/is_palindrome.irp.f | 31 ++++++++++ .../IRPF90_temp/is_palindrome.irp.module.F90 | 10 +++ .../IRPF90_temp/is_palindrome.irp.module.o | Bin 0 -> 942 bytes problem4/IRPF90_temp/is_palindrome.irp.o | Bin 0 -> 1440 bytes problem4/IRPF90_temp/is_palindrome_mod.mod | 22 +++++++ problem4/IRPF90_temp/o | 30 +++++++++ problem4/IRPF90_temp/prob4 | Bin 0 -> 9785 bytes problem4/IRPF90_temp/prob4.irp.F90 | 57 ++++++++++++++++++ problem4/IRPF90_temp/prob4.irp.f | 49 +++++++++++++++ problem4/IRPF90_temp/prob4.irp.module.F90 | 10 +++ problem4/IRPF90_temp/prob4.irp.module.o | Bin 0 -> 934 bytes problem4/IRPF90_temp/prob4.irp.o | Bin 0 -> 3120 bytes problem4/IRPF90_temp/prob4_mod.mod | 22 +++++++ problem4/Makefile | 12 ++++ problem4/README.md | 7 +++ problem4/irpf90.make | 41 +++++++++++++ problem4/irpf90_entities | 0 problem4/is_palindrome.irp.f | 31 ++++++++++ problem4/o | 30 +++++++++ problem4/prob4 | Bin 0 -> 9721 bytes problem4/prob4.irp.f | 49 +++++++++++++++ 31 files changed, 577 insertions(+) create mode 100644 problem4/IRPF90_temp/Makefile create mode 100644 problem4/IRPF90_temp/README.md create mode 100644 problem4/IRPF90_temp/irp_stack.irp.F90 create mode 100644 problem4/IRPF90_temp/irp_stack.irp.o create mode 100644 problem4/IRPF90_temp/irp_stack_mod.mod create mode 100644 problem4/IRPF90_temp/irp_touches.irp.F90 create mode 100644 problem4/IRPF90_temp/irp_touches.irp.o create mode 100644 problem4/IRPF90_temp/irpf90.make create mode 100644 problem4/IRPF90_temp/irpf90_entities create mode 100644 problem4/IRPF90_temp/is_palindrome.irp.F90 create mode 100644 problem4/IRPF90_temp/is_palindrome.irp.f create mode 100644 problem4/IRPF90_temp/is_palindrome.irp.module.F90 create mode 100644 problem4/IRPF90_temp/is_palindrome.irp.module.o create mode 100644 problem4/IRPF90_temp/is_palindrome.irp.o create mode 100644 problem4/IRPF90_temp/is_palindrome_mod.mod create mode 100644 problem4/IRPF90_temp/o create mode 100644 problem4/IRPF90_temp/prob4 create mode 100644 problem4/IRPF90_temp/prob4.irp.F90 create mode 100644 problem4/IRPF90_temp/prob4.irp.f create mode 100644 problem4/IRPF90_temp/prob4.irp.module.F90 create mode 100644 problem4/IRPF90_temp/prob4.irp.module.o create mode 100644 problem4/IRPF90_temp/prob4.irp.o create mode 100644 problem4/IRPF90_temp/prob4_mod.mod create mode 100644 problem4/Makefile create mode 100644 problem4/README.md create mode 100644 problem4/irpf90.make create mode 100644 problem4/irpf90_entities create mode 100644 problem4/is_palindrome.irp.f create mode 100644 problem4/o create mode 100755 problem4/prob4 create mode 100644 problem4/prob4.irp.f diff --git a/problem4/IRPF90_temp/Makefile b/problem4/IRPF90_temp/Makefile new file mode 100644 index 0000000..4602bb7 --- /dev/null +++ b/problem4/IRPF90_temp/Makefile @@ -0,0 +1,12 @@ +IRPF90 = irpf90 #-a -d +FC = gfortran +FCFLAGS= -O2 + +SRC= +OBJ= +LIB= + +include irpf90.make + +irpf90.make: $(wildcard *.irp.f) + $(IRPF90) diff --git a/problem4/IRPF90_temp/README.md b/problem4/IRPF90_temp/README.md new file mode 100644 index 0000000..0065736 --- /dev/null +++ b/problem4/IRPF90_temp/README.md @@ -0,0 +1,7 @@ +PROBLEM 3 +---------- + +* A palindromic number reads the same both ways. The largest palindrome made + from the product of two 2-digit numbers is 9009 = 91 99. + + Find the largest palindrome made from the product of two 3-digit numbers. diff --git a/problem4/IRPF90_temp/irp_stack.irp.F90 b/problem4/IRPF90_temp/irp_stack.irp.F90 new file mode 100644 index 0000000..5869495 --- /dev/null +++ b/problem4/IRPF90_temp/irp_stack.irp.F90 @@ -0,0 +1,38 @@ + +module irp_stack_mod + integer, parameter :: STACKMAX=1000 + character*(128),allocatable :: irp_stack(:,:) + double precision,allocatable :: irp_cpu(:,:) + integer,allocatable :: stack_index(:) + logical :: alloc = .False. + character*(128) :: white = '' +end module + +subroutine irp_enter(irp_where) + use irp_stack_mod + integer :: ithread + integer :: nthread + character*(*) :: irp_where + +!$OMP CRITICAL + ithread = 0 + nthread = 1 + +!$OMP END CRITICAL + + +end subroutine + +subroutine irp_leave (irp_where) + use irp_stack_mod + character*(*) :: irp_where + integer :: ithread + double precision :: cpu + +!$OMP CRITICAL + ithread = 0 + + +!$OMP END CRITICAL +end subroutine + diff --git a/problem4/IRPF90_temp/irp_stack.irp.o b/problem4/IRPF90_temp/irp_stack.irp.o new file mode 100644 index 0000000000000000000000000000000000000000..9b8cb95b1f8b34f33ceac7361a9ceb1f2d340655 GIT binary patch literal 1704 zcmc(f%}x|S5XWm+)Ky4e(Sr#p!wE>FLkz^|!A!Dz#rTmJO}sU|yG?e(&Mui9b@d`9 zK7dCrCccGN6JCU)2QGv&fvTCRq0@{f4pcJpuliN>banU4d|i97J`w~V7Qiz&kAwpJ zbYPU>2*#ia$NSr4YGUSlMvwQ;$B-9ZvB5^Y{xqClwT+JHh0E%(dbGH*kUP}h9lD_f zU*144oD8PNZ&ZKaS|^d+%Q65Xti+Z)25Rs*PE7+fO>%9Em)cji8!9}IIYdKSqx}=#f9i^ zalFSW5{kn*hg!wUAAi94LspSc9M*@ZG{5Y(qz~A+FMyS5$wXHiKTGiK#0?x@#tC|k z4ly}<;W9x~fZU@ZXzcn))7I14MXxn8nz@f5hetV8OXo4oKG z|7*w#DkUd%8&gwGKk^Gr_Vi%$?AC3oSl?&Z!(Wi$u@I=Z>UuNn`7a> znEzv5yjz`QS7(0_g`Qe}vIIo%FJlv(xm{~MS`Atkl{)UX^vl<)`cu1;+R{w+MBVAN i?65RnJnO&N=I)2moauJ^xcHFQLHj3rNNCyPvd?E1*Ok)% literal 0 HcmV?d00001 diff --git a/problem4/IRPF90_temp/irp_stack_mod.mod b/problem4/IRPF90_temp/irp_stack_mod.mod new file mode 100644 index 0000000..4c7ba10 --- /dev/null +++ b/problem4/IRPF90_temp/irp_stack_mod.mod @@ -0,0 +1,42 @@ +GFORTRAN module version '9' created from IRPF90_temp/irp_stack.irp.F90 +MD5:f65ae2717456353521ba97c4b0936c36 -- If you edit this, you'll get what you deserve. + +(() () () () () () () () () () () () () () () () () () () () () () () () +() () ()) + +() + +() + +() + +() + +() + +(2 'alloc' 'irp_stack_mod' '' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC +UNKNOWN IMPLICIT-SAVE 0 0) (LOGICAL 4 0 0 0 LOGICAL ()) 0 0 () () 0 () () +() 0 0) +3 'irp_cpu' 'irp_stack_mod' '' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC +UNKNOWN IMPLICIT-SAVE 0 0 ALLOCATABLE DIMENSION) (REAL 8 0 0 0 REAL ()) +0 0 () (2 0 DEFERRED () () () ()) 0 () () () 0 0) +4 'irp_stack' 'irp_stack_mod' '' 1 ((VARIABLE UNKNOWN-INTENT +UNKNOWN-PROC UNKNOWN IMPLICIT-SAVE 0 0 ALLOCATABLE DIMENSION) ( +CHARACTER 1 0 0 0 CHARACTER ((CONSTANT (INTEGER 4 0 0 0 INTEGER ()) 0 +'128'))) 0 0 () (2 0 DEFERRED () () () ()) 0 () () () 0 0) +5 'irp_stack_mod' 'irp_stack_mod' '' 1 ((MODULE UNKNOWN-INTENT +UNKNOWN-PROC UNKNOWN UNKNOWN 0 0) (UNKNOWN 0 0 0 0 UNKNOWN ()) 0 0 () () +0 () () () 0 0) +6 'stack_index' 'irp_stack_mod' '' 1 ((VARIABLE UNKNOWN-INTENT +UNKNOWN-PROC UNKNOWN IMPLICIT-SAVE 0 0 ALLOCATABLE DIMENSION) (INTEGER 4 +0 0 0 INTEGER ()) 0 0 () (1 0 DEFERRED () ()) 0 () () () 0 0) +7 'stackmax' 'irp_stack_mod' '' 1 ((PARAMETER UNKNOWN-INTENT +UNKNOWN-PROC UNKNOWN IMPLICIT-SAVE 0 0) (INTEGER 4 0 0 0 INTEGER ()) 0 0 +() (CONSTANT (INTEGER 4 0 0 0 INTEGER ()) 0 '1000') () 0 () () () 0 0) +8 'white' 'irp_stack_mod' '' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC +UNKNOWN IMPLICIT-SAVE 0 0) (CHARACTER 1 0 0 0 CHARACTER ((CONSTANT ( +INTEGER 4 0 0 0 INTEGER ()) 0 '128'))) 0 0 () () 0 () () () 0 0) +) + +('alloc' 0 2 'irp_cpu' 0 3 'irp_stack' 0 4 'irp_stack_mod' 0 5 +'stack_index' 0 6 'stackmax' 0 7 'white' 0 8) diff --git a/problem4/IRPF90_temp/irp_touches.irp.F90 b/problem4/IRPF90_temp/irp_touches.irp.F90 new file mode 100644 index 0000000..25f4020 --- /dev/null +++ b/problem4/IRPF90_temp/irp_touches.irp.F90 @@ -0,0 +1,3 @@ +subroutine irp_finalize_1703613751 + use is_palindrome_mod +end diff --git a/problem4/IRPF90_temp/irp_touches.irp.o b/problem4/IRPF90_temp/irp_touches.irp.o new file mode 100644 index 0000000000000000000000000000000000000000..27dfb8a252e9e0fe09eed29f87b1683af9047360 GIT binary patch literal 1232 zcmbVL%T59@6zw>u_*kIP!~{)nr6$sVh(s5LgjZsW3#02v!IB{|gPExbvT^IurJv!_ zy+7e+X#4=ZmuZJmSkYv9&OP_p7M^RD^*PHTYFXr*j4Y)R@;#!YJmh7vLXzb76O2Zs za+cYz@@9wmnPXa_N7>>*L{!>_B-Y@XSpAfhUR_MSLL=0-rEg9JBhv866RZg+f(Tv3 z1n&z%@0ehOHp7t6R?qXe51QW-oHnj*v!P(EdqM-=Wt6*4J76BytIy2Skcs!RU{oke zd+ZFLrHr^;urc2@^r~SiGogsYJ-{SS){X>y3NuiC2jH_S6Zn&ir@* zY1tG1232SBr8dE}uFVtw4m!buBYKZ5mxmNMt)J!yYVD5Cx}5=c@}*qiBwr{M^A6O= ML@kCVh--lM54izC`2YX_ literal 0 HcmV?d00001 diff --git a/problem4/IRPF90_temp/irpf90.make b/problem4/IRPF90_temp/irpf90.make new file mode 100644 index 0000000..36dabb4 --- /dev/null +++ b/problem4/IRPF90_temp/irpf90.make @@ -0,0 +1,41 @@ +SRC += IRPF90_temp/irp_stack.irp.F90 IRPF90_temp/irp_touches.irp.F90 IRPF90_temp/prob4.irp.F90 IRPF90_temp/prob4.irp.module.F90 IRPF90_temp/is_palindrome.irp.F90 IRPF90_temp/is_palindrome.irp.module.F90 +OBJ += IRPF90_temp/irp_stack.irp.o IRPF90_temp/is_palindrome.irp.o IRPF90_temp/is_palindrome.irp.module.o +OBJ1 = $(patsubst %, IRPF90_temp/%,$(notdir $(OBJ))) IRPF90_temp/irp_touches.irp.o +ALL = prob4 +ALL_OBJ = prob4.irp.module.o prob4.irp.o +ALL_OBJ1 = $(patsubst %, IRPF90_temp/%,$(notdir $(ALL_OBJ))) +all:$(ALL) + @$(MAKE) -s move +prob4: IRPF90_temp/prob4.irp.o IRPF90_temp/prob4.irp.module.o $(OBJ1) + $(FC) -o $@ IRPF90_temp/$@.irp.o IRPF90_temp/$@.irp.module.o $(OBJ1) $(LIB) + @$(MAKE) -s move +IRPF90_temp/prob4.irp.o: IRPF90_temp/prob4.irp.module.o +IRPF90_temp/is_palindrome.irp.o: IRPF90_temp/is_palindrome.irp.module.o +IRPF90_temp/irp_touches.irp.o: IRPF90_temp/is_palindrome.irp.o IRPF90_temp/is_palindrome.irp.o +IRPF90_temp/%.irp.module.o: IRPF90_temp/%.irp.module.F90 + $(FC) $(FCFLAGS) -c IRPF90_temp/$*.irp.module.F90 -o IRPF90_temp/$*.irp.module.o +IRPF90_temp/%.irp.o: IRPF90_temp/%.irp.module.o IRPF90_temp/%.irp.F90 + $(FC) $(FCFLAGS) -c IRPF90_temp/$*.irp.F90 -o IRPF90_temp/$*.irp.o +IRPF90_temp/%.irp.o: IRPF90_temp/%.irp.F90 + $(FC) $(FCFLAGS) -c IRPF90_temp/$*.irp.F90 -o IRPF90_temp/$*.irp.o +IRPF90_temp/%.o: %.F90 + $(FC) $(FCFLAGS) -c $*.F90 -o IRPF90_temp/$*.o +IRPF90_temp/%.o: %.f90 + $(FC) $(FCFLAGS) -c $*.f90 -o IRPF90_temp/$*.o +IRPF90_temp/%.o: %.f + $(FC) $(FCFLAGS) -c $*.f -o IRPF90_temp/$*.o +IRPF90_temp/%.o: %.F + $(FC) $(FCFLAGS) -c $*.F -o IRPF90_temp/$*.o +IRPF90_temp/%.irp.F90: irpf90.make + +move: + @mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING= + +clean: + rm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL) + +veryclean: + - $(MAKE) clean + + - rm -rf IRPF90_temp/ IRPF90_man/ irpf90.make irpf90_variables dist + diff --git a/problem4/IRPF90_temp/irpf90_entities b/problem4/IRPF90_temp/irpf90_entities new file mode 100644 index 0000000..e69de29 diff --git a/problem4/IRPF90_temp/is_palindrome.irp.F90 b/problem4/IRPF90_temp/is_palindrome.irp.F90 new file mode 100644 index 0000000..c0c8267 --- /dev/null +++ b/problem4/IRPF90_temp/is_palindrome.irp.F90 @@ -0,0 +1,33 @@ +! -*- F90 -*- +! +!-----------------------------------------------! +! This file was generated with the irpf90 tool. ! +! ! +! DO NOT MODIFY IT BY HAND ! +!-----------------------------------------------! + + subroutine is_palindrome(number,palin) ! is_palindrome.irp.f: 1 + implicit none ! is_palindrome.irp.f: 3 + character*(13) :: irp_here = 'is_palindrome' ! is_palindrome.irp.f: 1 + logical :: palin ! is_palindrome.irp.f: 4 + integer :: number,digit(1000),i,n1,j ! is_palindrome.irp.f: 5 + palin=.FALSE. ! is_palindrome.irp.f: 7 + do i=1,1000 ! is_palindrome.irp.f: 8 + digit(i)=10 ! is_palindrome.irp.f: 9 + enddo ! is_palindrome.irp.f: 10 + i=0 ! is_palindrome.irp.f: 12 + do while (number.gt.0) ! is_palindrome.irp.f: 13 + n1=number-10*(number/10) ! is_palindrome.irp.f: 15 + digit(i)=n1 ! is_palindrome.irp.f: 16 + number=number/10 ! is_palindrome.irp.f: 17 + i=i+(1) ! is_palindrome.irp.f: 18 + enddo ! is_palindrome.irp.f: 19 + palin=.TRUE. ! is_palindrome.irp.f: 22 + do j=0,int((i-1)/2) ! is_palindrome.irp.f: 23 + if(digit(j).ne.digit((i-1)-j))then ! is_palindrome.irp.f: 24 + palin=.FALSE. ! is_palindrome.irp.f: 25 + EXIT ! is_palindrome.irp.f: 26 + endif ! is_palindrome.irp.f: 27 + enddo ! is_palindrome.irp.f: 28 + return ! is_palindrome.irp.f: 30 +end ! is_palindrome.irp.f: 31 diff --git a/problem4/IRPF90_temp/is_palindrome.irp.f b/problem4/IRPF90_temp/is_palindrome.irp.f new file mode 100644 index 0000000..536aac2 --- /dev/null +++ b/problem4/IRPF90_temp/is_palindrome.irp.f @@ -0,0 +1,31 @@ + subroutine is_palindrome(number,palin) + + implicit none + logical :: palin + integer :: number,digit(1000),i,n1,j + + palin=.FALSE. + do i=1,1000 + digit(i)=10 + enddo + + i=0 + do while (number.gt.0) + + n1=number-10*(number/10) + digit(i)=n1 + number=number/10 + i+=1 + enddo + +! write(6,*)(digit(j),j=i-1,0,-1) + palin=.TRUE. + do j=0,int((i-1)/2) + if(digit(j).ne.digit((i-1)-j))then + palin=.FALSE. + EXIT + endif + enddo + + return + end diff --git a/problem4/IRPF90_temp/is_palindrome.irp.module.F90 b/problem4/IRPF90_temp/is_palindrome.irp.module.F90 new file mode 100644 index 0000000..16ba904 --- /dev/null +++ b/problem4/IRPF90_temp/is_palindrome.irp.module.F90 @@ -0,0 +1,10 @@ +! -*- F90 -*- +! +!-----------------------------------------------! +! This file was generated with the irpf90 tool. ! +! ! +! DO NOT MODIFY IT BY HAND ! +!-----------------------------------------------! + +module is_palindrome_mod +end module is_palindrome_mod diff --git a/problem4/IRPF90_temp/is_palindrome.irp.module.o b/problem4/IRPF90_temp/is_palindrome.irp.module.o new file mode 100644 index 0000000000000000000000000000000000000000..07d30d52967e7512930e05f73307712ab9dabc6c GIT binary patch literal 942 zcmbtS!AiqG5S=vD>d~7ZN_$elE=4S&2MN@+7xCs%WYa7dY?6|!peKL9&*-Ol^$T<+ z*)f|nCmq<#dvE4tc9(sd-po3l2OJ(;LCshNSl1AO5(lsin*j64;3IK@WHPJG}tn(^AGSccrgNUS-Ai|;mvB;7{rKqKuR$_j8H!QSVJXv%91NYEO z=fWK~B51IhbZc0m0e;EvJ9^-7rmp`G3tPDU>OVm*%^%^iBQRv&77FI-+B`2Z@VGVH<~{%%*V;UA}$_Qav7&lo+V1e`AQ^N^t@DJb}@o) D;V3c~ literal 0 HcmV?d00001 diff --git a/problem4/IRPF90_temp/is_palindrome.irp.o b/problem4/IRPF90_temp/is_palindrome.irp.o new file mode 100644 index 0000000000000000000000000000000000000000..c0558b0e531a41ad1d8bdbbb2960538eab14f36a GIT binary patch literal 1440 zcmbtT&1(}u6rW9Ejjc3MlnPZFA!q}3h+@(7AX%C;Ye_svy$NxXZfvmmAiII;rIfUg zrCky6zwqWsJvAycxwW3+pJ3HPPkvnLd%LrBGVDno%)Ix0@9Q@+%xXG2=aVGjibQUc zzn+T{(&fOU4JXM62@+-PTRcR_&JbdXm5R0%>t%Ejpi*ce1pzXQf!20FN$fTcHbWb| z(6cr`S?f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B$iUsN(Vxy7il>c4K9kKE@xl>-pNGM`L@ zwl%kHhUY3u1|5W0#~KEXDzZm~br6y$3=STJiA}-WOS-F!>u$hm(A!&^wUKEgBd`=f23U4x?jtl&;fdJ277oT0$7n z-`^eC)wLa3wj6mAFN__rJ?)X0v8S{1$&PNLJJKHOAb0W}yEj*mEkcG|4+C)-yY@tl zX9wiPdzBnnUlf%{9{G)b381qf>#p1y8it@!(C)a_muxy2Kb%A~NqLH-LMh+fmv8hn z&33omTs2&b#SD$7r4?C3xZ2i#6zKXMer@;n7&7IEo&RSr61j{q5Fbj=e;vB^pk9g8 zkWt7b(f-R6+B;mZ{qLaqKN~7)*1{1|$52xbw7T)sk)-Za&K2XsMWtZw75)N-w|I%ULPar%-%MMgbP6zb&5uVSL Je;$#Q{U5ItEf)X) literal 0 HcmV?d00001 diff --git a/problem4/IRPF90_temp/prob4.irp.F90 b/problem4/IRPF90_temp/prob4.irp.F90 new file mode 100644 index 0000000..b1bbb5a --- /dev/null +++ b/problem4/IRPF90_temp/prob4.irp.F90 @@ -0,0 +1,57 @@ +! -*- F90 -*- +! +!-----------------------------------------------! +! This file was generated with the irpf90 tool. ! +! ! +! DO NOT MODIFY IT BY HAND ! +!-----------------------------------------------! + +program irp_program ! prob4: 0 + call prob4 ! prob4.irp.f: 0 + call irp_finalize_1703613751() ! prob4.irp.f: 0 +end program ! prob4.irp.f: 0 +subroutine prob4 ! prob4.irp.f: 1 + implicit none ! prob4.irp.f: 3 + character*(5) :: irp_here = 'prob4' ! prob4.irp.f: 1 + integer :: i,j,number,k,ilim,jlim,palin(10000),maxpalin,cp,lim ! prob4.irp.f: 5 + logical :: palindrome ! prob4.irp.f: 6 + palindrome=.FALSE. ! prob4.irp.f: 8 + maxpalin=0 ! prob4.irp.f: 9 + cp=0 ! prob4.irp.f: 10 + do i=999,100,-1 ! prob4.irp.f: 11 + do j=999,i,-1 ! prob4.irp.f: 12 + number=i*j ! prob4.irp.f: 13 + call is_palindrome(number,palindrome) ! prob4.irp.f: 15 + if(palindrome)then ! prob4.irp.f: 17 + EXIT ! prob4.irp.f: 19 + endif ! prob4.irp.f: 20 + if(palindrome) then ! prob4.irp.f: 21 +EXIT ! prob4.irp.f: 21 + endif ! prob4.irp.f: 21 + enddo ! prob4.irp.f: 22 + if(palindrome) then ! prob4.irp.f: 23 +EXIT ! prob4.irp.f: 23 + endif ! prob4.irp.f: 23 + enddo ! prob4.irp.f: 24 + ilim=i ! prob4.irp.f: 25 + jlim=j ! prob4.irp.f: 26 + palindrome=.FALSE. ! prob4.irp.f: 27 + lim=MIN(ilim,jlim) ! prob4.irp.f: 29 + lim=lim-100 ! prob4.irp.f: 30 + do i=999,lim,-1 ! prob4.irp.f: 31 + do j=999,j,-1 ! prob4.irp.f: 32 + number=i*j ! prob4.irp.f: 33 + call is_palindrome(number,palindrome) ! prob4.irp.f: 34 + if(palindrome)then ! prob4.irp.f: 35 + cp=cp+(1) ! prob4.irp.f: 36 + palin(cp)=i*j ! prob4.irp.f: 37 + endif ! prob4.irp.f: 38 + enddo ! prob4.irp.f: 39 + enddo ! prob4.irp.f: 40 + do i=1,cp ! prob4.irp.f: 42 + if(maxpalin.le.palin(i)) then ! prob4.irp.f: 43 +maxpalin=palin(i) ! prob4.irp.f: 43 + endif ! prob4.irp.f: 43 + enddo ! prob4.irp.f: 44 + write(6,*)maxpalin ! prob4.irp.f: 46 +end ! prob4.irp.f: 49 diff --git a/problem4/IRPF90_temp/prob4.irp.f b/problem4/IRPF90_temp/prob4.irp.f new file mode 100644 index 0000000..1d74478 --- /dev/null +++ b/problem4/IRPF90_temp/prob4.irp.f @@ -0,0 +1,49 @@ + program prob4 + + implicit none + + integer :: i,j,number,k,ilim,jlim,palin(10000),maxpalin,cp,lim + logical :: palindrome + + palindrome=.FALSE. + maxpalin=0 + cp=0 + do i=999,100,-1 + do j=999,i,-1 + number=i*j +! write(6,*)number + call is_palindrome(number,palindrome) +! write(6,*)palindrome + if(palindrome)then +! write(6,*)i*j + EXIT + endif + if(palindrome)EXIT + enddo + if(palindrome)EXIT + enddo + ilim=i + jlim=j + palindrome=.FALSE. + + lim=MIN(ilim,jlim) + lim=lim-100 + do i=999,lim,-1 + do j=999,j,-1 + number=i*j + call is_palindrome(number,palindrome) + if(palindrome)then + cp+=1 + palin(cp)=i*j + endif + enddo + enddo + + do i=1,cp + if(maxpalin.le.palin(i))maxpalin=palin(i) + enddo + + write(6,*)maxpalin + + + end diff --git a/problem4/IRPF90_temp/prob4.irp.module.F90 b/problem4/IRPF90_temp/prob4.irp.module.F90 new file mode 100644 index 0000000..cc67007 --- /dev/null +++ b/problem4/IRPF90_temp/prob4.irp.module.F90 @@ -0,0 +1,10 @@ +! -*- F90 -*- +! +!-----------------------------------------------! +! This file was generated with the irpf90 tool. ! +! ! +! DO NOT MODIFY IT BY HAND ! +!-----------------------------------------------! + +module prob4_mod +end module prob4_mod diff --git a/problem4/IRPF90_temp/prob4.irp.module.o b/problem4/IRPF90_temp/prob4.irp.module.o new file mode 100644 index 0000000000000000000000000000000000000000..2d5a1c39635de12d5626da53bfe426d0614e63f9 GIT binary patch literal 934 zcmbtSO-sW-5S=vj>*z%U5$Z_=I}~XVJ;*|Bdl7FQJ#5;5MU#|d1wHu}{2BfBMmU>#sK9$)m1uHtB^)7}uz z@U%ZVt^fcQFNx6+Ws_I=UXY2O4d6l>4Hy*#;5tc@^$9n&+RpBiIKg;c*A(zxb^n2C^3eOv&N0z zfH!=`npul95wc{et;hwvA9eH)Nmf?O%7dFoGyeM7s(NaxRee`&(QB3SYRm7)nmenu z&fYFPQ(l)$X|dM`Pw529^IAH7aYR`RJkdkxR_@3R}gDo?bC#9=;rgg)V;& zzIimk8^*x)Ni}S?|FRTTG1;WPZk212e%Gp)Y6S8!E9)U-%yp~D>K6wdZfqp=4XgZ} z#HVOhJeDKuY_{gfmmp=8vq#7w*oxSVz zmRBX%-u`)HTh$k@qSpUh-JNFpsr)n-iQkXD@&lw7w&H)6?p1(~B~mQdN*e}%?&u4& zG974jCuqNVm~X(p4!dU$G=ON3RbGquGv7ksn+Ux8q5slrR9WT4Nd1*e2-tucF~Qzr{pag}6DN)-ZKgAl zN#&Gotyk+j($gLo7~}U9##|aA(o{@3xTiUC1p+O={N4loEl$)g$1XSZ%Pk*=ELo|B z`{lNeb_~cJAM7;bzH;+`TnmRjk>ox@?l9!Gepvx3g!Ic1LRuhv0v?p-@MX%eG&)eU z;>E0&8UgLOfu3NN>rAFJ&zbUwHkR^IL>nm(#wSh!4COfSO9&T7L#+egT0Td1H0$2U&J$tVaFTbLk;j^1AGqfeOw*b z{cxoL|5^k5>jpU4`eR*4O=fbM-q&-KSw$B-J^I69x_INt) zdTuIb7d`tOH{&@Rgm^LSxOOJzIpd&30*kT7@;QfOQ<)qWU35G<<&GBxh^9s0?}eSt z>$3Yj|+U} zD{wg9?Ny57@y4EK^MB6a*hdWilEd-NVK|!;=Xrv|S%;(MyO;g%K|b1So&#W`AddG8 Y!xgYm5PuS$dN}%+Oi}|edWHGOzrZA);s5{u literal 0 HcmV?d00001 diff --git a/problem4/IRPF90_temp/prob4_mod.mod b/problem4/IRPF90_temp/prob4_mod.mod new file mode 100644 index 0000000..36e2e72 --- /dev/null +++ b/problem4/IRPF90_temp/prob4_mod.mod @@ -0,0 +1,22 @@ +GFORTRAN module version '9' created from IRPF90_temp/prob4.irp.module.F90 +MD5:097acd06dda68ff8847be5a48b268e79 -- If you edit this, you'll get what you deserve. + +(() () () () () () () () () () () () () () () () () () () () () () () () +() () ()) + +() + +() + +() + +() + +() + +(2 'prob4_mod' 'prob4_mod' '' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC +UNKNOWN UNKNOWN 0 0) (UNKNOWN 0 0 0 0 UNKNOWN ()) 0 0 () () 0 () () () 0 +0) +) + +('prob4_mod' 0 2) diff --git a/problem4/Makefile b/problem4/Makefile new file mode 100644 index 0000000..4602bb7 --- /dev/null +++ b/problem4/Makefile @@ -0,0 +1,12 @@ +IRPF90 = irpf90 #-a -d +FC = gfortran +FCFLAGS= -O2 + +SRC= +OBJ= +LIB= + +include irpf90.make + +irpf90.make: $(wildcard *.irp.f) + $(IRPF90) diff --git a/problem4/README.md b/problem4/README.md new file mode 100644 index 0000000..0065736 --- /dev/null +++ b/problem4/README.md @@ -0,0 +1,7 @@ +PROBLEM 3 +---------- + +* A palindromic number reads the same both ways. The largest palindrome made + from the product of two 2-digit numbers is 9009 = 91 99. + + Find the largest palindrome made from the product of two 3-digit numbers. diff --git a/problem4/irpf90.make b/problem4/irpf90.make new file mode 100644 index 0000000..36dabb4 --- /dev/null +++ b/problem4/irpf90.make @@ -0,0 +1,41 @@ +SRC += IRPF90_temp/irp_stack.irp.F90 IRPF90_temp/irp_touches.irp.F90 IRPF90_temp/prob4.irp.F90 IRPF90_temp/prob4.irp.module.F90 IRPF90_temp/is_palindrome.irp.F90 IRPF90_temp/is_palindrome.irp.module.F90 +OBJ += IRPF90_temp/irp_stack.irp.o IRPF90_temp/is_palindrome.irp.o IRPF90_temp/is_palindrome.irp.module.o +OBJ1 = $(patsubst %, IRPF90_temp/%,$(notdir $(OBJ))) IRPF90_temp/irp_touches.irp.o +ALL = prob4 +ALL_OBJ = prob4.irp.module.o prob4.irp.o +ALL_OBJ1 = $(patsubst %, IRPF90_temp/%,$(notdir $(ALL_OBJ))) +all:$(ALL) + @$(MAKE) -s move +prob4: IRPF90_temp/prob4.irp.o IRPF90_temp/prob4.irp.module.o $(OBJ1) + $(FC) -o $@ IRPF90_temp/$@.irp.o IRPF90_temp/$@.irp.module.o $(OBJ1) $(LIB) + @$(MAKE) -s move +IRPF90_temp/prob4.irp.o: IRPF90_temp/prob4.irp.module.o +IRPF90_temp/is_palindrome.irp.o: IRPF90_temp/is_palindrome.irp.module.o +IRPF90_temp/irp_touches.irp.o: IRPF90_temp/is_palindrome.irp.o IRPF90_temp/is_palindrome.irp.o +IRPF90_temp/%.irp.module.o: IRPF90_temp/%.irp.module.F90 + $(FC) $(FCFLAGS) -c IRPF90_temp/$*.irp.module.F90 -o IRPF90_temp/$*.irp.module.o +IRPF90_temp/%.irp.o: IRPF90_temp/%.irp.module.o IRPF90_temp/%.irp.F90 + $(FC) $(FCFLAGS) -c IRPF90_temp/$*.irp.F90 -o IRPF90_temp/$*.irp.o +IRPF90_temp/%.irp.o: IRPF90_temp/%.irp.F90 + $(FC) $(FCFLAGS) -c IRPF90_temp/$*.irp.F90 -o IRPF90_temp/$*.irp.o +IRPF90_temp/%.o: %.F90 + $(FC) $(FCFLAGS) -c $*.F90 -o IRPF90_temp/$*.o +IRPF90_temp/%.o: %.f90 + $(FC) $(FCFLAGS) -c $*.f90 -o IRPF90_temp/$*.o +IRPF90_temp/%.o: %.f + $(FC) $(FCFLAGS) -c $*.f -o IRPF90_temp/$*.o +IRPF90_temp/%.o: %.F + $(FC) $(FCFLAGS) -c $*.F -o IRPF90_temp/$*.o +IRPF90_temp/%.irp.F90: irpf90.make + +move: + @mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING= + +clean: + rm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL) + +veryclean: + - $(MAKE) clean + + - rm -rf IRPF90_temp/ IRPF90_man/ irpf90.make irpf90_variables dist + diff --git a/problem4/irpf90_entities b/problem4/irpf90_entities new file mode 100644 index 0000000..e69de29 diff --git a/problem4/is_palindrome.irp.f b/problem4/is_palindrome.irp.f new file mode 100644 index 0000000..536aac2 --- /dev/null +++ b/problem4/is_palindrome.irp.f @@ -0,0 +1,31 @@ + subroutine is_palindrome(number,palin) + + implicit none + logical :: palin + integer :: number,digit(1000),i,n1,j + + palin=.FALSE. + do i=1,1000 + digit(i)=10 + enddo + + i=0 + do while (number.gt.0) + + n1=number-10*(number/10) + digit(i)=n1 + number=number/10 + i+=1 + enddo + +! write(6,*)(digit(j),j=i-1,0,-1) + palin=.TRUE. + do j=0,int((i-1)/2) + if(digit(j).ne.digit((i-1)-j))then + palin=.FALSE. + EXIT + endif + enddo + + return + end diff --git a/problem4/o b/problem4/o new file mode 100644 index 0000000..73bc8a9 --- /dev/null +++ b/problem4/o @@ -0,0 +1,30 @@ + 861168 + 888888 + 861168 + 828828 + 886688 + 824428 + 906609 + 819918 + 824428 + 819918 + 828828 + 855558 + 840048 + 737737 + 853358 + 809908 + 793397 + 749947 + 821128 + 801108 + 749947 + 828828 + 802208 + 780087 + 737737 + 807708 + 698896 + 678876 + 804408 + 906609 diff --git a/problem4/prob4 b/problem4/prob4 new file mode 100755 index 0000000000000000000000000000000000000000..f886e8507a123537b336d78aadd78af5305c6af1 GIT binary patch literal 9721 zcmc&)e{5UVb-pAen~oDoPMyYagqmq+KyE8Wv}H%ikM>cf>?fD99Y@Zx)y@-5QW9HA zRLMujPP0{p?9>mkY@rAWcSr_dXtx6E0Ih!vTDmnDuf6y+z@+5!`6HJM@BZNq{o>pccN^7F$c_Va;k=E#ng z2ePTAY-X@{tm#af4{Gg z`P%)rwteZl!NEQ2Hl000Wz-a^?>0QnM0Qp8NLw_nBv0*Fjb{xWlHmv051sCWWUz|# zH-J%@JADL|RKvp%47!EEe*sT5`726KhhMG#MMV+PaICpH74lL z!;Ax`IyhZ%;I#fY=_7CY=Y9%KA9=-pfl(nAxBtnSpjg~|2=BU08gj(c->Qj$)NM{aalm!HzDU+N?Od2@ev=f%?GZJN+8PM0LPIJrs_bDx9qJLBVI zS0AnYQ-4tCr%I-GamKbW^_BV_aZqm>2GK_r0=jkeY470+Q>a%8zH|6xDq5Va+cZqr z6mcv+z2JkqZhc>$zV;d2GoxES)GvQfggz~A=)Y#N{x6mO@T2o^K@`^=gy!6z!MVdf zto;cf&)XNMfAx_^Cu<>K-n-<&x`QwGV^@Ow;>_XsFF|GgC|=_-MgJ)JMD%-Ke5g)D z4@SGA|M+Y4&%wv_6L0!41Q%l=xxa!^9LE5P4(n>ndi$S9Ec&}&=woK6K_7cIv>{Tm z4uv+%y@*~O?G81Zdaby5j~ckZ82Hbq&K){x?sY^Wx-W%goCh@9<++|Wl#p2+LE6$|;{SIoNM zBZ<+LP{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ob4.irp.f new file mode 100644 index 0000000..1d74478 --- /dev/null +++ b/problem4/prob4.irp.f @@ -0,0 +1,49 @@ + program prob4 + + implicit none + + integer :: i,j,number,k,ilim,jlim,palin(10000),maxpalin,cp,lim + logical :: palindrome + + palindrome=.FALSE. + maxpalin=0 + cp=0 + do i=999,100,-1 + do j=999,i,-1 + number=i*j +! write(6,*)number + call is_palindrome(number,palindrome) +! write(6,*)palindrome + if(palindrome)then +! write(6,*)i*j + EXIT + endif + if(palindrome)EXIT + enddo + if(palindrome)EXIT + enddo + ilim=i + jlim=j + palindrome=.FALSE. + + lim=MIN(ilim,jlim) + lim=lim-100 + do i=999,lim,-1 + do j=999,j,-1 + number=i*j + call is_palindrome(number,palindrome) + if(palindrome)then + cp+=1 + palin(cp)=i*j + endif + enddo + enddo + + do i=1,cp + if(maxpalin.le.palin(i))maxpalin=palin(i) + enddo + + write(6,*)maxpalin + + + end