1
$\begingroup$

Based from the equation I used in the code below, I found how many values are divisible by 5. However, this is in boolean form. I only know how many are divisible by 5 which is 7500. I need to formulate a conjecture by exploring the values, but I'm having trouble figuring out how to create a list that gives me all the true 7500 numerical values that are divisible by 5 based from given function. Here's is my program.

expn = Flatten[Table[1^n + 2^n + 3^n + 4^n, {n, 1, 10000}]];
sumpowern = Mod[Total /@ expn, 5] ;
Count[sumpowern, 0]
posints = Length[Select[Divisible[Total /@ expn , 5], TrueQ]] 
$\endgroup$
3
  • 2
    $\begingroup$ Pick[expn, Thread[sumpowern == 0]] $\endgroup$
    – LouisB
    Sep 27, 2020 at 0:27
  • $\begingroup$ No, this just shows all 10000 values, I just want the 7500 values that were found divisible by 5 $\endgroup$
    – complab56
    Sep 27, 2020 at 16:52
  • $\begingroup$ Pick[expn, Mod[expn, 5], 0]? $\endgroup$
    – kglr
    Sep 27, 2020 at 21:42

1 Answer 1

1
$\begingroup$
Clear["`*"];
f[n_ /; n ∈ PositiveIntegers] := 1^n + 2^n + 3^n + 4^n;
test[n_] := TrueQ[Mod[f[n], 5] == 0];
Select[Range[10000], test]
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.