Try This Programming Question

rclakmal

Active member
  • May 8, 2008
    698
    183
    43
    In a galaxy far far away
    Hey Guys here a little bit hard(little bit) question !! I found it on Internet !! And I got the answer !! Give it a try .if u can find out the answer it will give u the same happiness that i got !! :D

    Post ur answer .....then i will give the correct one and my code
    Code:
    Find the largest product of five consecutive digits in the 1000-digit number.Below the number is given!
    
    73167176531330624919225119674426574742355349194934
     96983520312774506326239578318016984801869478851843
     85861560789112949495459501737958331952853208805511
     12540698747158523863050715693290963295227443043557
     66896648950445244523161731856403098711121722383113
     62229893423380308135336276614282806444486645238749
     30358907296290491560440772390713810515859307960866
     70172427121883998797908792274921901699720888093776
     65727333001053367881220235421809751254540594752243
     52584907711670556013604839586446706324415722155397
     53697817977846174064955149290862569321978468622482
     83972241375657056057490261407972968652414535100474
     82166370484403199890008895243450658541227588666881
     16427171479924442928230863465674813919123162824586
     17866458359124566529476545682848912883142607690042
     24219022671055626321111109370544217506941658960408
     07198403850962455444362981230987879927244284909188
     84580156166097919133875499200524063689912560717606
     05886116467109405077541002256983155200055935729725
     71636269561882670428252483600823257530420752963450

    try it !!!!!!!! For more codes go to below thread

    http://elakiri.com/forum/showthread.php?p=5955033#post5955033
     

    pjayampathi

    Well-known member
  • Jan 20, 2008
    6,253
    39
    48
    [
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace Euler
    {
    class Problem48 : IProblemBase
    {

    //The series, 1^(1) + 2^(2) + 3^(3) + ... + 10^(10) = 10405071317.

    //Find the last ten digits of the series, 1^(1) + 2^(2) + 3^(3) + ... + 1000^(1000).

    public Problem48()
    {
    }

    public string GetAnswer()
    {
    int limit = 1000;
    string result = string.Empty;

    for (int i = 1; i <= limit; i++)
    {
    result = Util.BigAdd(result, Util.BigPow2(i, i));
    }
    return result.Substring(result.Length - 10, 10);
    }

    }
    }

    /QUOTE]

    not my code.
     

    rclakmal

    Active member
  • May 8, 2008
    698
    183
    43
    In a galaxy far far away
    Matanam Melo deyak therenne nahe monawada me Kiyala diyallako apitath


    Machan meke ahanne dan oya deela thiyena diga no eka thiyenwane ....eke onema thnaka eka peliyata thiyena ( eka digata) digits 5 k aran wadikaloth (multiply) ganna puluwan wadima agaya keeyda kiyala ahanne ..........

    dan as an example 1st row eke 5th digit eka 7 ne ..eetapasse thiyena digits piliwelin 1,7,6,5 oki ........

    oya 5 wadikaloth answer eka =7*1*7*6*5=1470

    oya wage consecutive numbers 5k wadikrala ganna puluwan wadima agaya ahanne !!!!!

    Hope u got it !!!!!:)
     

    1118lakmalkumara

    Well-known member
  • May 21, 2009
    30,466
    3,160
    113
    斯里蘭卡
    Machan meke ahanne dan oya deela thiyena diga no eka thiyenwane ....eke onema thnaka eka peliyata thiyena ( eka digata) digits 5 k aran wadikaloth (multiply) ganna puluwan wadima agaya keeyda kiyala ahanne ..........

    dan as an example 1st row eke 5th digit eka 7 ne ..eetapasse thiyena digits piliwelin 1,7,6,5 oki ........

    oya 5 wadikaloth answer eka =7*1*7*6*5=1470

    oya wage consecutive numbers 5k wadikrala ganna puluwan wadima agaya ahanne !!!!!

    Hope u got it !!!!!:)

    I got but
    mole wehesanna one sahenna ekata
     

    IceCool123

    Member
    Feb 15, 2009
    116
    0
    0
    Answer is from Python

    file = open('number.txt', 'r')

    a = [int(line) for line in file]
    b = str(sum(a))
    print b[:5]

    file.close()

    number.txt contained the digit lines that you have provided.

    Answer is : 10641
     

    rclakmal

    Active member
  • May 8, 2008
    698
    183
    43
    In a galaxy far far away
    Answer is from Python

    file = open('number.txt', 'r')

    a = [int(line) for line in file]
    b = str(sum(a))
    print b[:5]

    file.close()

    number.txt contained the digit lines that you have provided.

    Answer is : 10641

    hmm sry dude answer is wrong !!!! But appreciate ur try !!!!! shall I give u the correct answer to try it?or will u give another try without the answer !
    Hint
    Here u have to consider all the occurrences. as i mentioned above u can pick 5 numbers from anywhere ......not 1 to 5 ,5 to 10 ,10 to 15
    It can be 6 to 11 ,13 to 18 like wise

    I think that is why u have got a wrong answer !