Puzzle of the day

Beja

Expert
Licensed User
Longtime User
A woman asked how many eggs in her basket? She said:
I don't know but....
If I moved them 2 by 2, or 3 by 3, or 4 by 4, or 5 by 5, or 6 by 6, then there's always 1 left. Only when I move them 7 by 7 is where nothing is left.

How many eggs she had?
Stay @home
 

rabbitBUSH

Well-Known Member
Licensed User
You'd need turtle library recursive fractal graphics to work backwards to count the nodes in the guide to the galaxy, so I asked the chickens in the yard : the answer is

42.
 

Jorge M A

Well-Known Member
Licensed User
Longtime User
I Have 301 Eggs! ?

B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    CalculateEggs
    
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub CalculateEggs()
    Dim i As Int=7
    
    Do While True
        If 1 = (i Mod 2) And 1 = (i Mod 3) And 1 = (i Mod 4) And 1 = (i Mod 5) And 1 = (i Mod 6) And 0 = ( i Mod 7) Then
            Log($"I Have ${i} Eggs!"$)
            Exit
        End If
        i=i+1
    Loop
End Sub
 

aeric

Expert
Licensed User
Longtime User
I Have 301 Eggs! ?

B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    CalculateEggs
    
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub CalculateEggs()
    Dim i As Int=7
    
    Do While True
        If 1 = (i Mod 2) And 1 = (i Mod 3) And 1 = (i Mod 4) And 1 = (i Mod 5) And 1 = (i Mod 6) And 0 = ( i Mod 7) Then
            Log($"I Have ${i} Eggs!"$)
            Exit
        End If
        i=i+1
    Loop
End Sub
How about other possibilities of value of i greater than 7?
 

Jorge M A

Well-Known Member
Licensed User
Longtime User
How about other possibilities.
I' don't care. There is only one question in the original puzzle and I found a "method" to resolve it. You can try sending rockets to the moon, but I took it just for fun.
 

sorex

Expert
Licensed User
Longtime User
I think it's 61201 eggs.

(s)he doesn't remove 2 but 2 by 2 so the mod check is different
 

rabbitBUSH

Well-Known Member
Licensed User
I wonder if it works the same way for avocados instead of eggs...
I will ask my neighbour he has 40 000 avocado trees, he should know, then we will know if we should still count the eggs in the basket.
 

ilan

Expert
Licensed User
Longtime User
it's the opposite, ilan.

it should list 1,1,1,1,1,0

sorry, the answer is 301 (i misread the first post)

B4X:
    Dim n(6) As Int = Array As Int(0,0,0,0,0,0)
    Dim nrstart As Int = 7
    Dim found As Boolean
    Do Until found
        For i = 2 To 7
            n(i-2) = nrstart Mod i
        Next
        If n(0) = 1 And n(1) = n(0) And n(2) = n(0) And n(3) = n(0) And n(4) = n(0) And n(5) = 0 Then
            found = True
            Exit
        End If      
        nrstart = nrstart + 1
    Loop

    Log(nrstart)
 
Last edited:
Top