Middle three digits: Difference between revisions
Content deleted Content added
GP |
→{{header|PARI/GP}}: Marked incorrect as valid answers must always have three digits |
||
Line 898: | Line 898: | ||
=={{header|PARI/GP}}== |
=={{header|PARI/GP}}== |
||
{{incorrect|PARI/GP|Valid answers must always have three digits.}} |
|||
{{works with|PARI/GP|2.6.0}} |
{{works with|PARI/GP|2.6.0}} |
||
<lang parigp>middle(n)=my(v=digits(n));if(#v>2&&#v%2,100*v[#v\2]+10*v[#v\2+1]+v[#v\2+2],"no middle 3 digits"); |
<lang parigp>middle(n)=my(v=digits(n));if(#v>2&&#v%2,100*v[#v\2]+10*v[#v\2+1]+v[#v\2+2],"no middle 3 digits"); |